mermaid-js/mermaid · error

Pipeline "${pipeline.parent}" must reference an existing com

Error message

Pipeline "${pipeline.parent}" must reference an existing component with coordinates.

What it means

While processing pipelines, the parser resolves each pipeline's parent through db.getNode(pipeline.parent); if the node is missing OR its y coordinate is not a number, it throws naming the parent. Pipelines must attach to a real, already-positioned component so their vertical placement is well-defined.

Source

Thrown at packages/mermaid/src/diagrams/wardley/wardleyParser.ts:141

      'component',
      labelOffsetX,
      labelOffsetY,
      component.inertia,
      sourceStrategy
    );
  });

  // Add notes
  ast.notes.forEach((note) => {
    const coords = toCoordinates(note.visibility, note.evolution, `Note "${note.text}"`);
    db.addNote(note.text, coords.x, coords.y);
  });

  // Process pipelines
  ast.pipelines.forEach((pipeline) => {
    const parentNode = db.getNode(pipeline.parent);
    if (!parentNode || typeof parentNode.y !== 'number') {
      throw new Error(
        `Pipeline "${pipeline.parent}" must reference an existing component with coordinates.`
      );
    }
    const parentY = parentNode.y; // Extract to ensure type narrowing

    db.startPipeline(pipeline.parent);
    pipeline.components.forEach((component) => {
      // Create a synthetic ID for pipeline components
      const componentId = `${pipeline.parent}_${component.name}`;
      const labelOffsetX = component.label
        ? (component.label.negX ? -1 : 1) * component.label.offsetX
        : undefined;
      const labelOffsetY = component.label
        ? (component.label.negY ? -1 : 1) * component.label.offsetY
        : undefined;
      const x = toPercent(component.evolution, `Pipeline component "${component.name}" evolution`);

      // Add pipeline component node (it will be associated with the parent)

View on GitHub (pinned to d93e9c88c0)

Solutions

  1. Declare the parent component with valid coordinates before referencing it in a pipeline.
  2. Match the pipeline parent name exactly to the component name.
  3. Remove pipelines whose parent no longer exists.
  4. Ensure the component's coordinate label parses (visibility and evolution both set).

Example fix

// before
pipeline Ghost { ... }  // Ghost undeclared

// after
component Ghost [0.6, 0.7]
pipeline Ghost { ... }
Defensive patterns

Strategy: validation

Validate before calling

// Ensure each pipeline parent resolves to a positioned component
for (const p of pipelines) {
  const node = db.getNode(p.parent);
  if (!node || typeof node.y !== 'number') {
    throw new Error(`Pipeline ${p.parent} needs a positioned parent component`);
  }
}

Type guard

const isPositionedNode = (n): n is WardleyNode =>
  n != null && typeof n.y === 'number' && typeof n.x === 'number';

Try / catch

try {
  await mermaid.run({ nodes: [el] });
} catch (e) {
  if (e instanceof Error && /must reference an existing component with coordinates/.test(e.message)) {
    // declare the parent component with [x, y] before the pipeline
  } else { throw e; }
}

Prevention

When it happens

Trigger: A `pipeline X { ... }` whose parent X was never declared as a component, or was declared without coordinates; a typo in the parent name; declaring the pipeline before the component exists.

Common situations: Renaming a component but not the pipeline parent reference; ordering pipelines before components; deleting a component and leaving orphan pipelines; coordinate label syntax errors so y stays unset.

Related errors


AI-assisted analysis of mermaid-js/mermaid@d93e9c88c0 (2026-08-12). Data as JSON: /api/errors/c228ee39db0c2aad. Report an issue: GitHub.