mermaid-js/mermaid · error
Node "${node.label}" is missing coordinates
Error message
Node "${node.label}" is missing coordinates What it means
wardleyBuilder.build() walks every node and requires numeric x and y coordinates before producing the layout result; any node still missing coordinates (x or y not a number) throws, naming the node label. This prevents rendering nodes at undefined positions.
Source
Thrown at packages/mermaid/src/diagrams/wardley/wardleyBuilder.ts:191
* (handles pipeline components which have synthetic IDs like "Parent_Child").
*/
public resolveNodeId(name: string): string {
if (this.nodes.has(name)) {
return name;
}
for (const [id, node] of this.nodes) {
if (node.label === name) {
return id;
}
}
return name;
}
public build(): WardleyBuildResult {
const nodes: WardleyNode[] = [];
for (const node of this.nodes.values()) {
if (typeof node.x !== 'number' || typeof node.y !== 'number') {
throw new Error(`Node "${node.label}" is missing coordinates`);
}
nodes.push(node as WardleyNode & { x: number; y: number });
}
return {
nodes,
links: [...this.links],
trends: [...this.trends.values()],
pipelines: [...this.pipelines.values()],
annotations: [...this.annotations],
notes: [...this.notes],
accelerators: [...this.accelerators],
deaccelerators: [...this.deaccelerators],
annotationsBox: this.annotationsBox,
axes: { ...this.axes },
size: this.size,
};
}
View on GitHub (pinned to d93e9c88c0)
Solutions
- Give the named component a coordinate label, e.g. `component Foo [0.5, 0.8]`.
- Verify the coordinate label syntax matches the current wardley grammar.
- If building programmatically, set node.x and node.y (numbers) before build().
- Check that notes/pipelines reference parents that already have coordinates.
Example fix
// before component Foo // after component Foo [0.5, 0.8]
Defensive patterns
Strategy: validation
Validate before calling
// Require numeric coordinates on every node before build()
for (const node of builder.getNodes?.() ?? []) {
if (typeof node.x !== 'number' || typeof node.y !== 'number') {
throw new Error(`Node ${node.label} needs coordinates`);
}
}
builder.build(); Type guard
const hasCoords = (n): n is WardleyNode => typeof n?.x === 'number' && typeof n?.y === 'number';
Try / catch
try {
builder.build();
} catch (e) {
if (e instanceof Error && /missing coordinates/.test(e.message)) {
// read the node label from the message and assign [x, y]
} else { throw e; }
} Prevention
- Always declare components with a [visibility, evolution] label.
- Validate coordinates upstream with the same rule as toPercent.
- Ensure pipeline parents have coordinates before referencing them.
When it happens
Trigger: A component declared without coordinates (no visibility/evolution pair), or one whose coordinate parsing was skipped/failed, reaching build(). Pipelines/notes that synthesise nodes without setting x/y can also surface here if their parent lacked coords.
Common situations: Declaring `component Foo` with no `[x, y]` label; a typo in the coordinate label format so the parser never assigns x/y; a node added via the db API directly without coordinates; version change in label syntax.
Related errors
- ${context} must be between 0-1 (decimal) or 0-100 (percentag
- Pipeline "${pipeline.parent}" must reference an existing com
- No nodes found in layout data
- Layout data is required
- Configuration is required in layout data
AI-assisted analysis of mermaid-js/mermaid@d93e9c88c0 (2026-08-12).
Data as JSON: /api/errors/9d69bd647aa8cdf7.
Report an issue: GitHub.