{"record":{"id":"f1d54bce71a1a8a1","repo":"marktext/marktext","slug":"unhandled-signal-type-s-type","errorCode":null,"errorMessage":"Unhandled signal type:${s.type}","messagePattern":"Unhandled signal type:(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/muyajs/lib/assets/libs/sequence-diagram-snap.js","lineNumber":1346,"sourceCode":"            b = a + 1\n          } else if (s.placement == PLACEMENT.OVER && s.hasManyActors()) {\n            // Over multiple actors\n            a = Math.min(s.actor[0].index, s.actor[1].index)\n            b = Math.max(s.actor[0].index, s.actor[1].index)\n\n            // We don't need our padding, and we want to overlap\n            extraWidth = -(NOTE_PADDING * 2 + NOTE_OVERLAP * 2)\n          } else if (s.placement == PLACEMENT.OVER) {\n            // Over single actor\n            a = s.actor.index\n            actorEnsureDistance(a - 1, a, s.width / 2)\n            actorEnsureDistance(a, a + 1, s.width / 2)\n            this.signalsHeight_ += s.height\n\n            return // Bail out early\n          }\n        } else {\n          throw new Error('Unhandled signal type:' + s.type)\n        }\n\n        actorEnsureDistance(a, b, s.width + extraWidth)\n        this.signalsHeight_ += s.height\n      },\n      this\n    )\n\n    // Re-jig the positions\n    var actorsX = 0\n    _.each(\n      actors,\n      function (a) {\n        a.x = Math.max(actorsX, a.x)\n\n        // TODO This only works if we loop in sequence, 0, 1, 2, etc\n        _.each(a.distances, function (distance, b) {\n          // lodash (and possibly others) do not like sparse arrays","sourceCodeStart":1328,"sourceCodeEnd":1364,"githubUrl":"https://github.com/marktext/marktext/blob/e52106fd1cdcbd33c1258b7b0cdc7013c4c5d86c/packages/muyajs/lib/assets/libs/sequence-diagram-snap.js#L1328-L1364","documentation":"Thrown inside the sequence-diagram layout pass (Diagram.Layout.drawSVG_.forEach over signals) when a signal object's `type` is neither 'Signal' nor 'Note'. The layout switch handles those two types explicitly; any other type cannot be measured/positioned and is rejected.","triggerScenarios":"A custom or malformed signal object pushed into the diagram's signal list with an unknown type; a parser bug creating a signal with a misspelled or unset type; a future signal kind not yet handled by the layout pass.","commonSituations":"User input that the parser turns into a partially-constructed signal (e.g. an incomplete self-message). A monkey-patched or forked sequence-diagram library introducing new signal types without updating the layout. Corrupt in-memory diagram state after an edit.","solutions":["Treat the input as invalid diagram syntax and show a user-facing parse error rather than letting it reach layout.","If extending the library, add the new signal type to the layout switch (and to drawSignal/drawNote).","Filter the signal list before layout: drop or warn on entries whose type is not 'Signal' or 'Note'.","Upgrade muyajs / the bundled sequence-diagram-snap.js if a parser fix exists upstream."],"exampleFix":"// before\n} else {\n  throw new Error('Unhandled signal type:' + s.type)\n}\n// after — skip unknown with a warning\n} else {\n  console.warn('Unhandled signal type:', s.type, '— skipped during layout')\n}","handlingStrategy":"validation","validationCode":"const SIGNAL_TYPES = new Set(['Signal', 'Note'])\nfunction isKnownSignalType(t: string): boolean { return SIGNAL_TYPES.has(t) }","typeGuard":"function isKnownSignal(s: { type: string }): boolean { return s.type === 'Signal' || s.type === 'Note' }","tryCatchPattern":"try { layout.drawSVG(signals) }\ncatch (e) { if (/Unhandled signal type/.test(e.message)) warnAndSkip(e) else throw e }","preventionTips":["Filter the signal list to known types before invoking layout.","Add new signal types to both layout and draw passes together.","Parse-validate diagram input so malformed signals never reach the library."],"tags":["sequence-diagram","layout","muyajs","validation"],"backgroundTag":null,"analyzedSha":"e52106fd1cdcbd33c1258b7b0cdc7013c4c5d86c","analyzedAt":"2026-08-12T13:58:32.443Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}