You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unexpected error: Failed to execute 'setStart' on 'Range': The offset 4294967292 is larger than the node's length (491). #2627
An unexpected error occurred in the renderer process.
Stack Trace
Error: Failed to execute 'setStart' on 'Range': The offset 4294967292 is larger than the node's length (491).
at Object.select (file:///usr/lib/marktext/app.asar/dist/electron/webpack:/src/muya/lib/selection/index.js:346:11)
at Object.setCursorRange (file:///usr/lib/marktext/app.asar/dist/electron/webpack:/src/muya/lib/selection/index.js:491:10)
at aa.setCursor (file:///usr/lib/marktext/app.asar/dist/electron/webpack:/src/muya/lib/contentState/index.js:205:15)
at aa.partialRender (file:///usr/lib/marktext/app.asar/dist/electron/webpack:/src/muya/lib/contentState/index.js:257:12)
at aa.inputHandler (file:///usr/lib/marktext/app.asar/dist/electron/webpack:/src/muya/lib/contentState/inputCtrl.js:324:51)
at HTMLDivElement.<anonymous> (file:///usr/lib/marktext/app.asar/dist/electron/webpack:/src/muya/lib/eventHandler/keyboard.js:203:22)
Version
Mark Text: v0.16.3 (c1d603f)
Operating system: Linux x64 5.10.59-1-MANJARO (linux)
Merging two lines of white-spaces (here spaces) result in an editor crash because the spaces are converted into a code bock. The cursor is invalid after this operation and overflows when setting the cursor in DOM.
Steps:
Type in editor mode and set cursor the the given position:
Type a and hit enter
Type two or three spaces and hit enter
Type two or three spaces and hit enter
Type b and position cursor
Press Shift, once ArrorLeft while holding shift and afterwards Backspace
Either the code block is generated and the correct cursor should be set or
all spaces are replaced by one space and the cursor may be adjusted.
Temporary Workaround:
Validate cursor before setting and use a fallback.
Stack Trace:
index.js?4d53:346 Uncaught DOMException: Failed to execute 'setStart' on 'Range': The offset 4294967293 is invalid.
at Selection.select (webpack-internal:///./src/muya/lib/selection/index.js:360:11)
at Selection.setCursorRange (webpack-internal:///./src/muya/lib/selection/index.js:527:10)
at ContentState.setCursor (webpack-internal:///./src/muya/lib/contentState/index.js:241:56)
at ContentState.partialRender (webpack-internal:///./src/muya/lib/contentState/index.js:326:12)
at ContentState.inputHandler (webpack-internal:///./src/muya/lib/contentState/inputCtrl.js:366:51)
at HTMLDivElement.inputHandler (webpack-internal:///./src/muya/lib/eventHandler/keyboard.js:248:22)
Closing this with the regression-guard e2e specs added in #4268.
The user-action recipe described here (and the same crash signature in ~25 other reports) does not reproduce on the current develop branch (0.18.9). The setCursorRange offset clamp at src/muya/lib/selection/index.js:524-530 plus cumulative refactor fixes appear to have closed the underlying bug.
The recipes from these reports are now encoded as Playwright tests in test/e2e/crash-range-offset.spec.ts so a regression here will fail CI before it reaches another user.
If you still hit this crash on a recent build, please reopen with the exact MarkText version and the markdown that triggered it.
Activity
Jocs commentedon Dec 29, 2021
How to reproduce this issue?
fxha commentedon Jan 12, 2022
Description:
Merging two lines of white-spaces (here spaces) result in an editor crash because the spaces are converted into a code bock. The cursor is invalid after this operation and overflows when setting the cursor in DOM.
Steps:
Type in editor mode and set cursor the the given position:
aand hit enterband position cursorShift, onceArrorLeftwhile holding shift and afterwardsBackspaceCursor before crash:
{ "start":{ "key":"ag-105", "offset": -2 }, "anchor":{ "key":"ag-105", "offset": -2 }, "end":{ "key":"ag-105", "offset": -2 }, "focus":{ "key":"ag-105", "offset": -2 } }Expected behavior:
Temporary Workaround:
Validate cursor before setting and use a fallback.
Stack Trace:
Jocs commentedon May 23, 2026
Closing this with the regression-guard e2e specs added in #4268.
The user-action recipe described here (and the same crash signature in ~25 other reports) does not reproduce on the current
developbranch (0.18.9). The setCursorRange offset clamp atsrc/muya/lib/selection/index.js:524-530plus cumulative refactor fixes appear to have closed the underlying bug.The recipes from these reports are now encoded as Playwright tests in
test/e2e/crash-range-offset.spec.tsso a regression here will fail CI before it reaches another user.If you still hit this crash on a recent build, please reopen with the exact MarkText version and the markdown that triggered it.
test(e2e): regression guards for previously-reported "Unexpected erro…
test(e2e): regression guards for previously-reported "Unexpected erro…