{"record":{"id":"c65f52aa6c1a9633","repo":"mermaid-js/mermaid","slug":"could-not-calculate-intersection-points-for-rel","errorCode":null,"errorMessage":"Could not calculate intersection points for rel \"${rel.from}\" -> \"${rel.to}\"","messagePattern":"Could not calculate intersection points for rel \"(.+?)\" -> \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mermaid/src/diagrams/c4/c4Renderer.ts","lineNumber":401,"sourceCode":"\n    if (rel.techn && rel.techn.text !== '') {\n      textLimitWidth = calculateTextWidth(rel.techn.text, relConf as TextDimensionConfig);\n      calcC4ShapeTextWH('techn', rel, relTextWrap, relConf, textLimitWidth);\n    }\n\n    if (rel.descr && rel.descr.text !== '') {\n      textLimitWidth = calculateTextWidth(rel.descr.text, relConf as TextDimensionConfig);\n      calcC4ShapeTextWH('descr', rel, relTextWrap, relConf, textLimitWidth);\n    }\n\n    const fromNode = getC4ShapeObj(rel.from);\n    const endNode = getC4ShapeObj(rel.to);\n    if (!fromNode || !endNode) {\n      throw new Error(`C4 rel \"${rel.from}\" -> \"${rel.to}\" references an unknown shape`);\n    }\n    const points = getIntersectPoints(fromNode, endNode);\n    if (!points.startPoint || !points.endPoint) {\n      throw new Error(\n        `Could not calculate intersection points for rel \"${rel.from}\" -> \"${rel.to}\"`\n      );\n    }\n    rel.startPoint = points.startPoint;\n    rel.endPoint = points.endPoint;\n  }\n  svgDraw.drawRels(diagram, rels, conf, diagramId);\n};\n\nasync function drawInsideBoundary(\n  diagram: SVG,\n  parentBoundaryAlias: string,\n  parentBounds: Bounds,\n  currentBoundaries: C4Boundary[],\n  diagObj: Diagram\n) {\n  const db = diagObj.db as C4DB;\n  const currentBounds = new Bounds(diagObj);","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/diagrams/c4/c4Renderer.ts#L383-L419","documentation":"Thrown by drawRels after getIntersectPoints returns a null/undefined startPoint or endPoint. getIntersectPoints calls getIntersectPoint on both shapes; if either shape's intersect function returns no usable point (or the shape has no intersect, though that case throws separately upstream), the result is incomplete and this error fires. It typically indicates degenerate geometry — e.g. a shape with zero width/height — rather than a missing alias.","triggerScenarios":"A C4 relationship between two shapes where at least one shape has degenerate dimensions (zero width or height) or an intersect function that returns no point. Can also follow from a shape whose intersect was never assigned if the upstream check was bypassed.","commonSituations":"Shapes with empty labels and a layout that collapses them to zero size; very small/negative dimensions from config; render after a partial earlier failure left shapes unmeasured.","solutions":["Ensure all C4 shapes have non-empty labels and non-zero configured dimensions.","Simplify the diagram to isolate which relationship/shape triggers the failure.","If shapes are well-formed and the error persists, report it — the intersection math should not produce null for valid shapes."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await mermaid.render(id, c4DiagramText);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('Could not calculate intersection points')) {\n    // Likely degenerate shape geometry — ensure non-empty labels and non-zero sizes.\n  }\n  throw err;\n}","preventionTips":["Give every C4 shape a non-empty label so it gets a non-zero bounding box.","Avoid configuring zero or negative shape dimensions."],"tags":["c4","relationship","geometry","render-time"],"backgroundTag":null,"analyzedSha":"d93e9c88c01a599c062ee6a3f1462e3558ac6b90","analyzedAt":"2026-08-12T06:23:11.304Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}