{"record":{"id":"c228ee39db0c2aad","repo":"mermaid-js/mermaid","slug":"pipeline-pipeline-parent-must-reference-an-ex","errorCode":null,"errorMessage":"Pipeline \"${pipeline.parent}\" must reference an existing component with coordinates.","messagePattern":"Pipeline \"(.+?)\" must reference an existing component with coordinates\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/mermaid/src/diagrams/wardley/wardleyParser.ts","lineNumber":141,"sourceCode":"      'component',\n      labelOffsetX,\n      labelOffsetY,\n      component.inertia,\n      sourceStrategy\n    );\n  });\n\n  // Add notes\n  ast.notes.forEach((note) => {\n    const coords = toCoordinates(note.visibility, note.evolution, `Note \"${note.text}\"`);\n    db.addNote(note.text, coords.x, coords.y);\n  });\n\n  // Process pipelines\n  ast.pipelines.forEach((pipeline) => {\n    const parentNode = db.getNode(pipeline.parent);\n    if (!parentNode || typeof parentNode.y !== 'number') {\n      throw new Error(\n        `Pipeline \"${pipeline.parent}\" must reference an existing component with coordinates.`\n      );\n    }\n    const parentY = parentNode.y; // Extract to ensure type narrowing\n\n    db.startPipeline(pipeline.parent);\n    pipeline.components.forEach((component) => {\n      // Create a synthetic ID for pipeline components\n      const componentId = `${pipeline.parent}_${component.name}`;\n      const labelOffsetX = component.label\n        ? (component.label.negX ? -1 : 1) * component.label.offsetX\n        : undefined;\n      const labelOffsetY = component.label\n        ? (component.label.negY ? -1 : 1) * component.label.offsetY\n        : undefined;\n      const x = toPercent(component.evolution, `Pipeline component \"${component.name}\" evolution`);\n\n      // Add pipeline component node (it will be associated with the parent)","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/diagrams/wardley/wardleyParser.ts#L123-L159","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Declare the parent component with valid coordinates before referencing it in a pipeline.","Match the pipeline parent name exactly to the component name.","Remove pipelines whose parent no longer exists.","Ensure the component's coordinate label parses (visibility and evolution both set)."],"exampleFix":"// before\npipeline Ghost { ... }  // Ghost undeclared\n\n// after\ncomponent Ghost [0.6, 0.7]\npipeline Ghost { ... }","handlingStrategy":"validation","validationCode":"// Ensure each pipeline parent resolves to a positioned component\nfor (const p of pipelines) {\n  const node = db.getNode(p.parent);\n  if (!node || typeof node.y !== 'number') {\n    throw new Error(`Pipeline ${p.parent} needs a positioned parent component`);\n  }\n}","typeGuard":"const isPositionedNode = (n): n is WardleyNode =>\n  n != null && typeof n.y === 'number' && typeof n.x === 'number';","tryCatchPattern":"try {\n  await mermaid.run({ nodes: [el] });\n} catch (e) {\n  if (e instanceof Error && /must reference an existing component with coordinates/.test(e.message)) {\n    // declare the parent component with [x, y] before the pipeline\n  } else { throw e; }\n}","preventionTips":["Declare parent components with coordinates before their pipelines.","Keep pipeline parent names in sync when renaming components.","Remove pipelines whose parent has been deleted."],"tags":["wardley","pipeline","missing-reference","coordinates","validation"],"backgroundTag":null,"analyzedSha":"d93e9c88c01a599c062ee6a3f1462e3558ac6b90","analyzedAt":"2026-08-12T06:23:11.304Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}