{"record":{"id":"1bc0a0290ab96918","repo":"mermaid-js/mermaid","slug":"no-such-shape-node-shape-please-check-your-sy","errorCode":null,"errorMessage":"No such shape: ${node.shape}. Please check your syntax.","messagePattern":"No such shape: (.+?)\\. Please check your syntax\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mermaid/src/rendering-util/rendering-elements/nodes.ts","lineNumber":34,"sourceCode":"  node: NonClusterNode,\n  renderOptions: ShapeRenderOptions\n) {\n  let newEl: NodeElement | undefined;\n  let el;\n\n  //special check for rect shape (with or without rounded corners)\n  if (node.shape === 'rect') {\n    if (node.rx && node.ry) {\n      node.shape = 'roundedRect';\n    } else {\n      node.shape = 'squareRect';\n    }\n  }\n\n  const shapeHandler = node.shape ? shapes[node.shape] : undefined;\n\n  if (!shapeHandler) {\n    throw new Error(`No such shape: ${node.shape}. Please check your syntax.`);\n  }\n\n  if (node.link) {\n    // Add link when appropriate\n    let target;\n    if (renderOptions.config.securityLevel === 'sandbox') {\n      target = '_top';\n    } else if (node.linkTarget) {\n      target = node.linkTarget || '_blank';\n    }\n    newEl = elem\n      .insert<SVGAElement>('svg:a')\n      .attr('xlink:href', node.link)\n      .attr('target', target ?? null);\n    el = await shapeHandler(newEl, node, renderOptions);\n  } else {\n    el = await shapeHandler(elem, node, renderOptions);\n    newEl = el;","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/rendering-util/rendering-elements/nodes.ts#L16-L52","documentation":"Thrown by insertNode when node.shape is falsy or has no matching entry in the `shapes` map (built in shapes.ts from shortNames/aliases/internalAliases plus undocumented shapes). The rect branch above normalizes 'rect' to 'roundedRect'/'squareRect', so anything else that isn't a registered shape id falls through to this throw.","triggerScenarios":"A node whose shape is undefined/null (e.g. a diagram-db bug that didn't assign a shape), or a typoed/unsupported shape string like 'Rect' (case), 'box', 'roundrect', or a shape removed in the current version. The lookup is `shapes[node.shape]`; if it returns undefined, this fires.","commonSituations":"Custom node construction that omits shape, a downgrade/upgrade where a shape alias was renamed or removed (the shapes.ts alias lists evolve), or user-facing syntax that maps to a shape id no longer present. Also from diagrams that set shape from config without validating against the supported set.","solutions":["Use a supported shape id (see shapes.ts): e.g. 'roundedRect', 'squareRect', 'circle', 'stadium', 'cylinder', 'hexagon', 'bow-rect', 'note', 'question', etc.","Ensure the diagram-db layer always assigns a known shape (default to a rectangle variant if unspecified).","For custom shapes, register them in the shapes map before rendering.","Validate with isValidShape(node.shape) (exported from shapes.ts) before insertNode."],"exampleFix":"// before\nnode.shape = 'box'; // not a registered shape id\n// after\nnode.shape = 'squareRect'; // or 'roundedRect'","handlingStrategy":"validation","validationCode":"import { isValidShape } from './shapes.js';\nif (!isValidShape(node.shape)) throw new Error(`unsupported node shape: ${node.shape}`);","typeGuard":"function isValidNodeShape(s: unknown, shapes: Record<string, unknown>): boolean { return typeof s === 'string' && s in shapes; }","tryCatchPattern":"try { await insertNode(elem, node, opts); } catch (e) { if (/No such shape/.test(String(e))) { node.shape = 'squareRect'; insertNode(elem, node, opts); } else throw e; }","preventionTips":["Use the exported isValidShape() guard before insertNode.","Always default node.shape to a known id when constructing nodes.","Pin mermaid version to avoid shape-alias breakage."],"tags":["render","shapes","nodes","validation"],"backgroundTag":null,"analyzedSha":"d93e9c88c01a599c062ee6a3f1462e3558ac6b90","analyzedAt":"2026-08-12T06:23:11.304Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}