{"record":{"id":"8c157f3f3bb647b4","repo":"mermaid-js/mermaid","slug":"the-created-participant-this-state-records-lastc","errorCode":null,"errorMessage":"The created participant ${this.state.records.lastCreated.name} does not have an associated creating message after its declaration. Please check the sequence diagram.","messagePattern":"The created participant (.+?) does not have an associated creating message after its declaration\\. Please check the sequence diagram\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/mermaid/src/diagrams/sequence/sequenceDb.ts","lineNumber":625,"sourceCode":"        case 'addNote':\n          this.addNote(param.actor, param.placement, param.text);\n          break;\n        case 'addLinks':\n          this.addLinks(param.actor, param.text);\n          break;\n        case 'addALink':\n          this.addALink(param.actor, param.text);\n          break;\n        case 'addProperties':\n          this.addProperties(param.actor, param.text);\n          break;\n        case 'addDetails':\n          this.addDetails(param.actor, param.text);\n          break;\n        case 'addMessage':\n          if (this.state.records.lastCreated) {\n            if (param.to !== this.state.records.lastCreated) {\n              throw new Error(\n                'The created participant ' +\n                  this.state.records.lastCreated.name +\n                  ' does not have an associated creating message after its declaration. Please check the sequence diagram.'\n              );\n            } else {\n              this.state.records.lastCreated = undefined;\n            }\n          } else if (this.state.records.lastDestroyed) {\n            if (\n              param.to !== this.state.records.lastDestroyed &&\n              param.from !== this.state.records.lastDestroyed\n            ) {\n              throw new Error(\n                'The destroyed participant ' +\n                  this.state.records.lastDestroyed.name +\n                  ' does not have an associated destroying message after its declaration. Please check the sequence diagram.'\n              );\n            } else {","sourceCodeStart":607,"sourceCodeEnd":643,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/diagrams/sequence/sequenceDb.ts#L607-L643","documentation":"When `create Participant` is parsed, lastCreated is set; the very next message must be addressed `to` that participant (the creating message). If the next message's `to` differs, mermaid throws because the create would be orphaned — a created participant must be born by a message targeting it.","triggerScenarios":"A `create` directive followed by a message whose recipient is not the created actor, or by a non-message statement, before any message `to` the created actor.","commonSituations":"Inserting a comment or another statement right after `create`; mistyping the target name; reordering messages so the create is no longer adjacent to its intro message; tooling that emits `create` and the message separately.","solutions":["Make the message immediately after `create X` target X (`A ->> create X`).","Remove the `create` if you only need a normal participant (use `participant`).","Ensure no blank statements break the create→message adjacency.","Double-check the created id spelling matches the recipient exactly."],"exampleFix":"// before\ncreate Bob\nAlice ->> Charlie : hi  // not addressed to Bob\n\n// after\ncreate Bob\nAlice ->> Bob : hi","handlingStrategy":"validation","validationCode":"// Structural check: a create must be immediately followed by a message to that actor\nfor (let i = 0; i < lines.length; i++) {\n  if (/^\\s*create\\s+(\\S+)/.test(lines[i])) {\n    const id = RegExp.$1;\n    const next = lines[i + 1];\n    if (!next || !new RegExp(`->.*${id}|${id}.*->`).test(next)) {\n      throw new Error(`create ${id} not followed by a message to ${id}`);\n    }\n  }\n}","typeGuard":"const isCreateOrphanError = (e): boolean =>\n  e instanceof Error && /created participant .* does not have an associated creating message/.test(e.message);","tryCatchPattern":"try {\n  await mermaid.run({ nodes: [el] });\n} catch (e) {\n  if (e instanceof Error && /created participant .* does not have/.test(e.message)) {\n    // ensure next line after `create X` is `A ->> X : ...`\n  } else { throw e; }\n}","preventionTips":["Keep `create X` adjacent to a message addressed to X.","Don't insert statements between create and its intro message.","Prefer `participant X` when you don't need create semantics."],"tags":["sequence","participant","create","message-flow","validation"],"backgroundTag":null,"analyzedSha":"d93e9c88c01a599c062ee6a3f1462e3558ac6b90","analyzedAt":"2026-08-12T06:23:11.304Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}