{"record":{"id":"5ef7f52c38e998f9","repo":"mermaid-js/mermaid","slug":"the-junction-id-s-parent-does-not-exist-plea","errorCode":null,"errorMessage":"The junction [${id}]'s parent does not exist. Please make sure the parent is created before this junction","messagePattern":"The junction \\[(.+?)\\]'s parent does not exist\\. Please make sure the parent is created before this junction","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/mermaid/src/diagrams/architecture/architectureDb.ts","lineNumber":129,"sourceCode":"    });\n  }\n\n  public getServices(): ArchitectureService[] {\n    return [...this.nodes.values()].filter(isArchitectureService);\n  }\n\n  public addJunction({ id, in: parent }: Omit<ArchitectureJunction, 'edges'>): void {\n    if (this.registeredIds.has(id)) {\n      throw new Error(\n        `The junction id [${id}] is already in use by another ${this.registeredIds.get(id)}`\n      );\n    }\n    if (parent !== undefined) {\n      if (id === parent) {\n        throw new Error(`The junction [${id}] cannot be placed within itself`);\n      }\n      if (!this.registeredIds.has(parent)) {\n        throw new Error(\n          `The junction [${id}]'s parent does not exist. Please make sure the parent is created before this junction`\n        );\n      }\n      if (this.registeredIds.get(parent) === 'node') {\n        throw new Error(`The junction [${id}]'s parent is not a group`);\n      }\n    }\n\n    this.registeredIds.set(id, 'node');\n\n    this.nodes.set(id, {\n      id,\n      type: 'junction',\n      edges: [],\n      in: parent,\n    });\n  }\n","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/diagrams/architecture/architectureDb.ts#L111-L147","documentation":"Thrown by addJunction when a parent ('in') is specified but that parent id is not in registeredIds. Parents must be declared first (usually a group), so a forward reference, typo, or wrong ordering is rejected.","triggerScenarios":"addJunction({ id: 'j', in: 'grp' }) before 'grp' is added; parent id misspelled.","commonSituations":"Junction defined before its containing group in user text, or parent id case mismatch.","solutions":["Declare the parent group before the junction.","Confirm parent id spelling/case.","Omit 'in' for a top-level junction."],"exampleFix":"// before\ndb.addJunction({ id: 'j', in: 'grp' }); // grp missing\n\n// after\ndb.addGroup({ id: 'grp' });\ndb.addJunction({ id: 'j', in: 'grp' });","handlingStrategy":"validation","validationCode":"if (parent && db.getNode(parent) === null) {\n  throw new Error(`Parent '${parent}' not declared`);\n}\ndb.addJunction({ id, in: parent });","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare the parent group before the junction.","Order declarations parent-first.","Verify parent id spelling and case."],"tags":["architecture","mermaid","validation","parent","ordering","junction"],"backgroundTag":null,"analyzedSha":"d93e9c88c01a599c062ee6a3f1462e3558ac6b90","analyzedAt":"2026-08-12T06:23:11.304Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}