LearnNewsExamplesServices
Frontmatter
id8150
titleRegression: Monaco Editor double-initialization error
stateClosed
labels
bugairegression
assigneestobiu
createdAtDec 20, 2025, 1:04 AM
updatedAtDec 20, 2025, 1:31 AM
githubUrlhttps://github.com/neomjs/neo/issues/8150
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtDec 20, 2025, 1:31 AM

Regression: Monaco Editor double-initialization error

Closed v11.17.0 bugairegression
tobiu
tobiu commented on Dec 20, 2025, 1:04 AM

Symptom: After the recent architecture changes (#8149), the Monaco Editor wrapper started throwing: Error: Element already has context attribute: neo-monaco-editor... This indicates monaco.editor.create(node, ...) is being called twice on the same DOM element.

Immediate Fix: Made Neo.main.addon.MonacoEditor.createInstance idempotent by adding a check:

if (me.map[id]) {
    return
}

This prevents the crash but masks the underlying issue.

Root Cause Investigation Needed: We need to determine why createInstance is being invoked multiple times.

  • Hypothesis 1: The processCachedMethodCalls mechanism in Neo.main.addon.Base might be replaying a call that was also executed live (race condition).
  • Hypothesis 2: The wrapper component (src/component/wrapper/MonacoEditor.mjs) might be sending the message twice (e.g., afterSetMounted triggering multiple times).
  • Hypothesis 3: The new windowId routing logic might be delivering the same message twice (unlikely but possible).

This ticket tracks the regression fix and the subsequent investigation.

tobiu added the bug label on Dec 20, 2025, 1:04 AM
tobiu added the ai label on Dec 20, 2025, 1:04 AM
tobiu added the regression label on Dec 20, 2025, 1:04 AM
tobiu assigned to @tobiu on Dec 20, 2025, 1:05 AM
tobiu referenced in commit c91c725 - "#8150 quick fix" on Dec 20, 2025, 1:05 AM
tobiu referenced in commit b493b62 - "#8150 component.wrapper.MonacoEditor: afterSetWindowId() => clearing out main thread instances" on Dec 20, 2025, 1:31 AM
tobiu closed this issue on Dec 20, 2025, 1:31 AM