Skip to content

Unexpected error with message Cannot use numerical key for object container #4827

Closed as not planned

Description

@weilai201

Description

Unexpected renderer process error.

Minimal Reprouducible Markdown Example (or Steps)

Stack Trace

Error: Cannot use numerical key for object container
    at assert (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-D8_UerJB.js:146249:24)
    at insertChildMut (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-D8_UerJB.js:146288:99)
    at drop2 (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-D8_UerJB.js:146393:127)
    at drop2 (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-D8_UerJB.js:146390:27)
    at drop2 (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-D8_UerJB.js:146390:27)
    at Object.apply2 [as apply] (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-D8_UerJB.js:146400:9)
    at JSONState._apply (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-D8_UerJB.js:147068:44)
    at JSONState._flushOperationCache (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-D8_UerJB.js:147221:10)
    at file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-D8_UerJB.js:147201:12

Version

MarkText: v0.20.0-beta.5
Operating system: Darwin arm64 25.5.0 (darwin)

Activity

  1. Jocs commented on Jul 4, 2026

    @Jocs
    Member

    Thanks for the report!

    This crash happens in the deferred state-flush path (JSONState._flushOperationCache → _apply → ot-json1 apply → drop/insertChildMut). Muya batches the edit operations produced within one animation frame and compose()s them into a single op before applying it. The message Cannot use numerical key for object container is ot-json1 rejecting the composed op: one of its inserts targets a numeric index inside a block object (i.e. the coalesced operations disagreed about the document structure), so the op can't be applied to the document.

    I tried hard to reproduce it on current develop (0.20.0-dev) — ~25 same-frame/coalesced editing scenarios through the deferred flush path: paragraph↔list/heading/blockquote/thematic-break conversions, multi-line and task-list conversions, back-to-back conversions, list merge/split/indent/outdent, and edit-after-convert. None reproduced this crash — the operation batches all composed and applied cleanly.

    What I could not drive in a headless test is real IME composition, and that looks like the likely trigger here:

    Given I can't reproduce it, I'm closing this for now — but it may be a genuine coalesced-op bug in the same area. If you can reproduce it, please reopen with:

    • your OS input method / language (e.g. Pinyin, Japanese, Korean), and
    • the exact keystrokes / text and the document context (were you inside a list, table, converting a line to a heading/list, etc.),

    and we'll fix it. A build newer than beta.5 (with #4815/#4838) is also worth trying, in case it was the same IME null-op path surfacing differently.

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