Skip to content

Unexpected error with message Invalid offset - splits unicode bytes #5027

Closed

Description

@justnoww

Description

Unexpected renderer process error.

Minimal Reprouducible Markdown Example (or Steps)

Stack Trace

Error: Invalid offset - splits unicode bytes
    at unicount.strPosToUni (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-BXt6R5Ri.js:99249:13)
    at exports2.dlen (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-BXt6R5Ri.js:99332:70)
    at checkOp (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-BXt6R5Ri.js:99281:26)
    at Object.apply (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-BXt6R5Ri.js:99583:11)
    at drop2 (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-BXt6R5Ri.js:146616:57)
    at Object.apply2 [as apply] (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-BXt6R5Ri.js:146621:9)
    at JSONState._apply (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-BXt6R5Ri.js:147289:44)
    at JSONState._flushOperationCache (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-BXt6R5Ri.js:147442:10)
    at file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-BXt6R5Ri.js:147422:12

Version

MarkText: v0.20.0-rc.1
Operating system: Darwin arm64 25.5.0 (darwin)

Activity

  1. Jocs commented on Sep 14, 2026

    @Jocs
    Member

    Thanks for the report!

    Invalid offset - splits unicode bytes is the emoji deletion crash tracked in #4926. With the caret right after an emoji at the end of a paragraph (or just before inline markup such as **), Backspace removed only half of the emoji's UTF-16 surrogate pair. The editor's text operations can't encode that leftover half, so that edit and every edit after it threw this error. Depending on what came next, the stack ends in apply (the next Backspace) or in compose / xfBoundary (any later edit) — your stack is one of these.

    It is fixed on develop:

    The fixes will ship in the next release after v0.20.0-rc.2. If you still see this error on that release, please open a new issue with the steps (the text you were editing and the keys you pressed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions