{"record":{"id":"b2f6f52070658005","repo":"mermaid-js/mermaid","slug":"missing-entry-for-axis-axis-label","errorCode":null,"errorMessage":"Missing entry for axis ${axis.label}","messagePattern":"Missing entry for axis (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/mermaid/src/diagrams/radar/db.ts","lineNumber":87,"sourceCode":"      label: curve.label ?? curve.name,\n      entries: computeCurveEntries(curve.entries),\n    };\n  });\n};\n\nconst computeCurveEntries = (entries: Entry[]): number[] => {\n  // If entries have axis reference, we must order them according to the axes\n  if (entries[0].axis == undefined) {\n    return entries.map((entry) => entry.value);\n  }\n  const axes = getAxes();\n  if (axes.length === 0) {\n    throw new Error('Axes must be populated before curves for reference entries');\n  }\n  return axes.map((axis) => {\n    const entry = entries.find((entry) => entry.axis?.$refText === axis.name);\n    if (entry === undefined) {\n      throw new Error('Missing entry for axis ' + axis.label);\n    }\n    return entry.value;\n  });\n};\n\nconst setOptions = (options: Option[]) => {\n  // Create a map from option names to option objects for quick lookup\n  const optionMap = options.reduce(\n    (acc, option) => {\n      acc[option.name] = option;\n      return acc;\n    },\n    {} as Record<string, Option>\n  );\n\n  data.options = {\n    showLegend: (optionMap.showLegend?.value as boolean) ?? defaultOptions.showLegend,\n    ticks: (optionMap.ticks?.value as number) ?? defaultOptions.ticks,","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/diagrams/radar/db.ts#L69-L105","documentation":"Thrown while building a radar curve's entry vector: for each declared axis the code searches the curve's entries for one whose `axis.$refText` equals the axis name. If no entry points at that axis, the curve is incomplete and the message reports the axis label that is missing. This guarantees the emitted curve has exactly one value per axis.","triggerScenarios":"A curve that references axes by name but omits one or more of them (e.g. 5 axes declared, a curve supplies entries for only 4). Also triggered by a typo in an axis reference name so `$refText` never matches, leaving that axis unpaired.","commonSituations":"Hand-editing radar diagram text and forgetting a value; copy-pasting a curve and not updating all axis refs; renaming an axis after curves were written so the old ref text no longer matches; CSV/data-driven generation that drops sparse rows.","solutions":["Add the missing entry for the axis named in the message to that curve.","Verify every axis name in the curve's references exactly matches a declared axis name (case/whitespace).","Reduce the axis set to only those the curve actually provides values for.","Generate curves from a table keyed by axis name to guarantee full coverage."],"exampleFix":"// before — axis \"Performance\" has no entry in this curve\naxis Performance, Cost, Security\ncurve v1 [Performance: 0.8, Cost: 0.4]\n\n// after\ncurve v1 [Performance: 0.8, Cost: 0.4, Security: 0.6]","handlingStrategy":"validation","validationCode":"// Verify each curve covers every axis before setCurves\nconst axisNames = new Set(db.getAxes().map(a => a.name));\nfor (const curve of curves) {\n  if (curve.entries[0]?.axis == null) continue;\n  for (const axisName of axisNames) {\n    if (!curve.entries.some(e => e.axis?.$refText === axisName)) {\n      throw new Error(`Curve ${curve.name} is missing axis ${axisName}`);\n    }\n  }\n}","typeGuard":"const coversAllAxes = (entries: Entry[], axisNames: string[]): boolean => {\n  const refs = new Set(entries.filter(e => e.axis?.$refText != null).map(e => e.axis.$refText));\n  return axisNames.every(n => refs.has(n));\n};","tryCatchPattern":"try {\n  db.setCurves(curves);\n} catch (e) {\n  const m = e instanceof Error && e.message.match(/Missing entry for axis (.+)/);\n  if (m) {\n    // prompt user to add the axis value, then rebuild\n    reportMissingAxis(curveName, m[1]);\n  } else { throw e; }\n}","preventionTips":["Generate curves from an axis-keyed map so coverage is structural.","Lint diagram text to ensure each curve has one entry per axis.","Validate axis reference spelling against the declared axis names."],"tags":["radar","missing-data","diagram-db","validation"],"backgroundTag":null,"analyzedSha":"d93e9c88c01a599c062ee6a3f1462e3558ac6b90","analyzedAt":"2026-08-12T06:23:11.304Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}