Skip to content

Unexpected error: Cannot destructure property 'pathname' of 'A.tabs[n]' as it is undefined. #3100

Closed

Description

@Anarion-zuo

Description

An unexpected error occurred in the renderer process.

Stack Trace

TypeError: Cannot destructure property 'pathname' of 'A.tabs[n]' as it is undefined.
    at forEach (file:///usr/lib/marktext/app.asar/dist/electron/webpack:/src/renderer/store/editor.js:256:15)
    at Array.forEach (<anonymous>)
    at Store.CLOSE_TABS (file:///usr/lib/marktext/app.asar/dist/electron/webpack:/src/renderer/store/editor.js:254:15)
    at wrappedMutationHandler (/usr/lib/marktext/app.asar/node_modules/vuex/dist/vuex.common.js:846:13)
    at commitIterator (/usr/lib/marktext/app.asar/node_modules/vuex/dist/vuex.common.js:468:7)
    at Array.forEach (<anonymous>)
    at /usr/lib/marktext/app.asar/node_modules/vuex/dist/vuex.common.js:467:11
    at Store._withCommit (/usr/lib/marktext/app.asar/node_modules/vuex/dist/vuex.common.js:626:3)
    at Store.commit (/usr/lib/marktext/app.asar/node_modules/vuex/dist/vuex.common.js:466:8)
    at boundCommit (/usr/lib/marktext/app.asar/node_modules/vuex/dist/vuex.common.js:411:19)

Version

Mark Text: v0.16.3 (N/A)
Operating system: Linux x64 5.15.25-1-MANJARO (linux)

Activity

  1. Anarion-zuo commented on Mar 4, 2022

    @Anarion-zuo
    Author

    This is an generated by MarkText automatically right after I clicked don't save of opened files.

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

    @Jocs
    Member

    Closing — this was fixed during the Vuex → Pinia migration.

    CLOSE_TABS now uses a nullish-coalescing fallback at src/renderer/src/store/editor.ts:1044:

    const closed = this.tabs[index]
    const { pathname } = closed ?? { pathname: '' }

    so a concurrent mutation that removes a tab between findIndex and the array access no longer crashes.

    If you still see this on a recent build, please reopen with the exact version and the multi-tab 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