mermaid-js/mermaid · error
Missing entry for axis ${axis.label}
Error message
Missing entry for axis ${axis.label} What it means
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.
Source
Thrown at packages/mermaid/src/diagrams/radar/db.ts:87
label: curve.label ?? curve.name,
entries: computeCurveEntries(curve.entries),
};
});
};
const computeCurveEntries = (entries: Entry[]): number[] => {
// If entries have axis reference, we must order them according to the axes
if (entries[0].axis == undefined) {
return entries.map((entry) => entry.value);
}
const axes = getAxes();
if (axes.length === 0) {
throw new Error('Axes must be populated before curves for reference entries');
}
return axes.map((axis) => {
const entry = entries.find((entry) => entry.axis?.$refText === axis.name);
if (entry === undefined) {
throw new Error('Missing entry for axis ' + axis.label);
}
return entry.value;
});
};
const setOptions = (options: Option[]) => {
// Create a map from option names to option objects for quick lookup
const optionMap = options.reduce(
(acc, option) => {
acc[option.name] = option;
return acc;
},
{} as Record<string, Option>
);
data.options = {
showLegend: (optionMap.showLegend?.value as boolean) ?? defaultOptions.showLegend,
ticks: (optionMap.ticks?.value as number) ?? defaultOptions.ticks,View on GitHub (pinned to d93e9c88c0)
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.
Example fix
// before — axis "Performance" has no entry in this curve axis Performance, Cost, Security curve v1 [Performance: 0.8, Cost: 0.4] // after curve v1 [Performance: 0.8, Cost: 0.4, Security: 0.6]
Defensive patterns
Strategy: validation
Validate before calling
// Verify each curve covers every axis before setCurves
const axisNames = new Set(db.getAxes().map(a => a.name));
for (const curve of curves) {
if (curve.entries[0]?.axis == null) continue;
for (const axisName of axisNames) {
if (!curve.entries.some(e => e.axis?.$refText === axisName)) {
throw new Error(`Curve ${curve.name} is missing axis ${axisName}`);
}
}
} Type guard
const coversAllAxes = (entries: Entry[], axisNames: string[]): boolean => {
const refs = new Set(entries.filter(e => e.axis?.$refText != null).map(e => e.axis.$refText));
return axisNames.every(n => refs.has(n));
}; Try / catch
try {
db.setCurves(curves);
} catch (e) {
const m = e instanceof Error && e.message.match(/Missing entry for axis (.+)/);
if (m) {
// prompt user to add the axis value, then rebuild
reportMissingAxis(curveName, m[1]);
} else { throw e; }
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Axes must be populated before curves for reference entries
- No nodes found in layout data
- Layout data is required
- Configuration is required in layout data
- Nodes array is required in layout data
AI-assisted analysis of mermaid-js/mermaid@d93e9c88c0 (2026-08-12).
Data as JSON: /api/errors/b2f6f52070658005.
Report an issue: GitHub.