Skip to content

[Bug] Keyboard selection of code language causes renderer crash (TypeError: Cannot read properties of null (reading 'functionType')) #4896

Closed as duplicate

Description

@lin-b-github

Description

Description

When creating a fenced code block using the keyboard, selecting the language from the autocomplete popup with the keyboard causes the renderer to crash.

Selecting the same language with the mouse works correctly.

Steps to Reproduce

Steps to reproduce

  1. Create a new Markdown document.
  2. Type: ```python
  3. The language autocomplete appears.
  4. Use the Down Arrow to highlight Python.
  5. Press Enter.

Expected Behavior

  • Python is selected.
  • Cursor moves into the code block ready for typing.

Actual Behavior

  • Renderer crashes with:
    TypeError: Cannot read properties of null (reading 'functionType') ...

Screenshots / Logs

Workarounds

  • Selecting Python with the mouse works correctly.
  • Pasting a complete fenced code block also works.
  • Keyboard navigation consistently reproduces the error.

Note: This appears to affect keyboard-only editing workflows, since the mouse path succeeds while the keyboard path consistently crashes.

Error code generated in application:

Unexpected renderer process error TypeError: Cannot read properties of null (reading 'functionType') at ContentState2.updateCodeLanguage (file:///app/marktext/resources/app.asar/out/renderer/assets/index-ClkWA0Ji.js:131905:16) at ContentState2.selectLanguage (file:///app/marktext/resources/app.asar/out/renderer/assets/index-ClkWA0Ji.js:131894:10) at cb (file:///app/marktext/resources/app.asar/out/renderer/assets/index-ClkWA0Ji.js:143790:26) at CodePicker.selectItem (file:///app/marktext/resources/app.asar/out/renderer/assets/index-ClkWA0Ji.js:147536:5) at HTMLDivElement.handler (file:///app/marktext/resources/app.asar/out/renderer/assets/index-ClkWA0Ji.js:147501:16)

Operating System

Linux (Flatpak)

MarkText Version

v0.19.0

OS Version

MX Linux Fluxbox 21: Debian GNU/Linux 11 (bullseye)

Reproducibility

  • I can reliably reproduce this issue

Activity

  1. Jocs commented on Sep 11, 2026

    @Jocs
    Member

    Thanks for the detailed report!

    This crash comes from the legacy editor engine that shipped with MarkText v0.19.x: TypeError: Cannot read properties of null (reading 'functionType') in ContentState.updateCodeLanguage. It is the same crash as #4620.

    MarkText 0.20 replaced that engine with a rewritten one (@muyajs/core), so this code path no longer exists on develop or in v0.20.0-rc.1.

    I also followed your steps on the current develop engine in a real browser. Typing ```python, moving through the language list with the arrow keys (or Tab) and pressing Enter creates a code block in the highlighted language with the cursor inside it, and there is no error. Pressing Enter right away, or clicking an item with the mouse, works the same way.

    Closing as a duplicate of #4620. If you still see a crash on v0.20.0-rc.1 or newer, please open a new issue with the steps.

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