Joplin encountered a fatal error and could not continue

Operating system

Windows

Joplin version

2.14.0

Desktop version info

Joplin 2.14.22 (prod, win32)

Client-ID: 940a5f79e780459cbb2e2a1b66c85b59
Sync-Version: 3
Profil-Version: 46
Unterstützter Schlüsselbund: Ja

Revision: e579eb9

Backup: 1.4.0

Sync target

Joplin Server

Editor

Markdown Editor

What issue do you have?

Hello,

I receive the following error message from my desktop application several times a day:


Error
Joplin encountered a fatal error and could not continue.

To report the error, please copy the entire content of this page and post it on Joplin forum or GitHub.

If the error persists you may try to restart in safe mode, which will temporarily disable all plugins.

Message
Selection points outside of document

Version info
Joplin for Desktop

Copyright © 2016-2024 Laurent Cozic
Joplin 2.14.22 (prod, win32)

Client-ID: 940a5f79e780459cbb2e2a1b66c85b59
Sync-Version: 3
Profil-Version: 46
Unterstützter Schlüsselbund: Ja

Revision: e579eb9

Backup: 1.4.0
Plugins
[
{
"id": "io.github.jackgruber.backup",
"name": "Backup",
"enabled": true,
"version": "1.4.0"
}
]
Stack trace
RangeError: Selection points outside of document
at checkSelection (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules@joplin\editor\node_modules@codemirror\state\dist\index.cjs:1560:19)
at new Transaction (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules@joplin\editor\node_modules@codemirror\state\dist\index.cjs:2272:13)
at Transaction.create (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules@joplin\editor\node_modules@codemirror\state\dist\index.cjs:2280:16)
at resolveTransaction (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules@joplin\editor\node_modules@codemirror\state\dist\index.cjs:2453:26)
at EditorState.update (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules@joplin\editor\node_modules@codemirror\state\dist\index.cjs:2626:16)
at CodeMirrorControl.updateBody (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules@joplin\editor\CodeMirror\CodeMirrorControl.js:87:52)
at C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\gui\NoteEditor\NoteBody\CodeMirror\v6\CodeMirror.js:351:78
at commitHookEffectListMount (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-dom\cjs\react-dom.development.js:23150:26)
at commitPassiveMountOnFiber (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-dom\cjs\react-dom.development.js:24926:13)
at commitPassiveMountEffects_complete (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-dom\cjs\react-dom.development.js:24891:9)
Component stack

at CodeMirror (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\gui\NoteEditor\NoteBody\CodeMirror\v6\CodeMirror.js:49:44)
at div
at div
at div
at NoteEditor (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\gui\NoteEditor\NoteEditor.js:70:68)
at ConnectFunction (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-redux\lib\components\connect.js:246:74)
at div
at I (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\styled-components\dist\styled-components.cjs.js:1:19269)
at div
at Resizable (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\re-resizable\lib\index.es5.js:211:28)
at div
at ResizableLayout (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\gui\ResizableLayout\ResizableLayout.js:47:45)
at div
at MainScreenComponent (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\gui\MainScreen\MainScreen.js:75:9)
at ConnectFunction (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-redux\lib\components\connect.js:246:74)
at div
at NavigatorComponent (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\gui\Navigator.js:7:1)
at ConnectFunction (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-redux\lib\components\connect.js:246:74)
at exports.ThemeProvider (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\styled-components\dist\styled-components.cjs.js:1:25001)
at ae (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\styled-components\dist\styled-components.cjs.js:1:13440)
at RootComponent (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\gui\Root.js:103:1)
at ConnectFunction (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-redux\lib\components\connect.js:246:74)
at ErrorBoundary (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\gui\ErrorBoundary.js:21:9)
at Provider (C:\Users\patrick.asmus\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-redux\lib\components\Provider.js:19:3)

This mainly happens when I switch from one note entry to the next.

1 Like

Thank you for reporting this — this issue is related to the beta markdown editor. Specifically, it's coming from this line:

I was able to reproduce this error with this part of Joplin's code, a cursor at the end of a note, and CRLF line endings. (Example on CodeMirror's try page.)

In the beta editor, cursor positions are represented by numbers. For example, if the cursor was at the end of a document with content 123456, the cursor would have position 6. It seems, however, that while a CRLF line ending is two JavaScript characters, it's just one cursor increment.

I've tried reproducing this with a multi-character symbol (":hole:"), but haven't been able to.

To fix this, Joplin should use EditorState.toText(...).length to determine the maximum position, rather than using the string length. In CodeMirror's try-it editor, this seems to fix the issue.

1 Like

Thank you very much for your feedback.

Is there anything else I can do to give you more information?

Thank you very much.
Regards, Patrick

I've opened a pull request:

For now, I suggest disabling the beta editor (settings > general > un-check "opt in to the editor beta").

1 Like

Thank you for doing that.
I will comply with your request and deactivate the beta editor for the time being.

I wish you a good start into the new week.
Patrick

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.