mermaid-js/mermaid · error
The junction [${id}]'s parent does not exist. Please make su
Error message
The junction [${id}]'s parent does not exist. Please make sure the parent is created before this junction What it means
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.
Source
Thrown at packages/mermaid/src/diagrams/architecture/architectureDb.ts:129
});
}
public getServices(): ArchitectureService[] {
return [...this.nodes.values()].filter(isArchitectureService);
}
public addJunction({ id, in: parent }: Omit<ArchitectureJunction, 'edges'>): void {
if (this.registeredIds.has(id)) {
throw new Error(
`The junction id [${id}] is already in use by another ${this.registeredIds.get(id)}`
);
}
if (parent !== undefined) {
if (id === parent) {
throw new Error(`The junction [${id}] cannot be placed within itself`);
}
if (!this.registeredIds.has(parent)) {
throw new Error(
`The junction [${id}]'s parent does not exist. Please make sure the parent is created before this junction`
);
}
if (this.registeredIds.get(parent) === 'node') {
throw new Error(`The junction [${id}]'s parent is not a group`);
}
}
this.registeredIds.set(id, 'node');
this.nodes.set(id, {
id,
type: 'junction',
edges: [],
in: parent,
});
}
View on GitHub (pinned to d93e9c88c0)
Solutions
- Declare the parent group before the junction.
- Confirm parent id spelling/case.
- Omit 'in' for a top-level junction.
Example fix
// before
db.addJunction({ id: 'j', in: 'grp' }); // grp missing
// after
db.addGroup({ id: 'grp' });
db.addJunction({ id: 'j', in: 'grp' }); Defensive patterns
Strategy: validation
Validate before calling
if (parent && db.getNode(parent) === null) {
throw new Error(`Parent '${parent}' not declared`);
}
db.addJunction({ id, in: parent }); Prevention
- Declare the parent group before the junction.
- Order declarations parent-first.
- Verify parent id spelling and case.
When it happens
Trigger: addJunction({ id: 'j', in: 'grp' }) before 'grp' is added; parent id misspelled.
Common situations: Junction defined before its containing group in user text, or parent id case mismatch.
Related errors
- The service [${id}]'s parent does not exist. Please make sur
- The junction [${id}]'s parent is not a group
- The service [${id}] cannot be placed within itself
- The service [${id}]'s parent is not a group
- The junction id [${id}] is already in use by another ${this.
AI-assisted analysis of mermaid-js/mermaid@d93e9c88c0 (2026-08-12).
Data as JSON: /api/errors/5ef7f52c38e998f9.
Report an issue: GitHub.