{"record":{"id":"5f9c3f0c9fa3a84a","repo":"mermaid-js/mermaid","slug":"the-service-id-s-parent-does-not-exist-pleas","errorCode":null,"errorMessage":"The service [${id}]'s parent does not exist. Please make sure the parent is created before this service","messagePattern":"The service \\[(.+?)\\]'s parent does not exist\\. Please make sure the parent is created before this service","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/mermaid/src/diagrams/architecture/architectureDb.ts","lineNumber":92,"sourceCode":"\n  public addService({\n    id,\n    icon,\n    in: parent,\n    title,\n    iconText,\n  }: Omit<ArchitectureService, 'edges'>): void {\n    if (this.registeredIds.has(id)) {\n      throw new Error(\n        `The service 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 service [${id}] cannot be placed within itself`);\n      }\n      if (!this.registeredIds.has(parent)) {\n        throw new Error(\n          `The service [${id}]'s parent does not exist. Please make sure the parent is created before this service`\n        );\n      }\n      if (this.registeredIds.get(parent) === 'node') {\n        throw new Error(`The service [${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: 'service',\n      icon,\n      iconText,\n      title,\n      edges: [],\n      in: parent,","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/diagrams/architecture/architectureDb.ts#L74-L110","documentation":"Thrown by addService when a parent ('in') is specified but that parent id is not present in registeredIds. Architecture requires parents to be declared first (typically a group), so a forward reference or a typo'd parent id is rejected.","triggerScenarios":"addService({ id: 'svc', in: 'missing' }) where 'missing' was never added; declaring a child before its parent group.","commonSituations":"User writes a service inside a group that is defined later in the text, or the parent's id has a typo/case mismatch.","solutions":["Declare the parent group before the service that uses it.","Verify the parent id spelling and case against the registered group id.","If parentless, omit the 'in' field."],"exampleFix":"// before\ndb.addService({ id: 'svc', in: 'grp' }); // grp not yet defined\n\n// after\ndb.addGroup({ id: 'grp' });\ndb.addService({ id: 'svc', in: 'grp' });","handlingStrategy":"validation","validationCode":"if (parent && db.getNode(parent) === null) {\n  throw new Error(`Parent '${parent}' not declared`);\n}\ndb.addService({ id, in: parent });","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare groups before services that nest in them.","Sort architecture declarations parent-first before insertion.","Validate parent id spelling and case."],"tags":["architecture","mermaid","validation","parent","ordering"],"backgroundTag":null,"analyzedSha":"d93e9c88c01a599c062ee6a3f1462e3558ac6b90","analyzedAt":"2026-08-12T06:23:11.304Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}