Skip to content

Unexpected error: Cannot destructure property 'text' of 'n' as it is null. #2099

Closed

Description

@pempek

Description

An unexpected error occurred in the renderer process.

I just openen a new file and using @ I tried to add Header 1 when the error occured.

Stack Trace

TypeError: Cannot destructure property 'text' of 'n' as it is null.
    at $r.updateParagraph (file:///usr/lib/marktext/app.asar/dist/electron/webpack:/src/muya/lib/contentState/paragraphCtrl.js:451:13)
    at Dc.selectItem (file:///usr/lib/marktext/app.asar/dist/electron/webpack:/src/muya/lib/ui/quickInsert/index.js:136:22)
    at Object.call (file:///usr/lib/marktext/app.asar/dist/electron/webpack:/src/muya/lib/ui/quickInsert/index.js:68:22)
    at invokeHandler (file:///usr/lib/marktext/app.asar/dist/electron/webpack:/node_modules/snabbdom/modules/eventlisteners.js:6:17)
    at handleEvent (file:///usr/lib/marktext/app.asar/dist/electron/webpack:/node_modules/snabbdom/modules/eventlisteners.js:34:9)
    at HTMLDivElement.A (file:///usr/lib/marktext/app.asar/dist/electron/webpack:/node_modules/snabbdom/modules/eventlisteners.js:39:9)

Version

Mark Text: v0.16.1 (7f80be4)
Operating system: Linux x64 5.4.36-1-MANJARO (linux)

Activity

  1. added
    🐛 bug
    🐞 pri/critical
    on May 16, 2026
  2. Jocs commented on May 23, 2026

    @Jocs
    Member

    Closing this with the regression-guard e2e specs added in #4268.

    The crash in paragraphCtrl.updateParagraph no longer reproduces on the current develop. The upstream guard at src/muya/lib/ui/quickInsert/index.js:160-164 (which short-circuits when this.block is null) plus isAllowedTransformation filtering prevent the null block from reaching the destructuring statement.

    The original recipe (type @ then pick Header 1) and adjacent paths (delete-paragraph-then-menu) are encoded as Playwright tests in test/e2e/crash-update-paragraph.spec.ts.

    If you still hit this crash on a recent build, please reopen with the exact MarkText version and the steps that triggered it.

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

    🐛 bug🐞 pri/critical🔭 area/editor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions