plotly/plotly.js · error
Total value for node <d.data.data.id> of <trace.name> is sma
Error message
Total value for node <d.data.data.id> of <trace.name> is smaller than the sum of its children. parent value = <v> children sum = <partialSum>
What it means
During sunburst value propagation (src/traces/sunburst/calc.js:171), each internal node's value is compared with the sum of its children's values. If the parent's explicit value is smaller than the children's sum (beyond an ALMOST_EQUAL tolerance), the geometry is inconsistent, the trace is marked failed, and Plotly warns with both values.
Source
Thrown at src/traces/sunburst/calc.js:171
case 'total':
hierarchy.each(function(d) {
var cdi = d.data.data;
var v = cdi.v;
if(d.children) {
var partialSum = d.children.reduce(function(a, c) {
return a + c.data.data.v;
}, 0);
// N.B. we must fill in `value` for generated sectors
// with the partialSum to compute the correct partition
if(cdi.hasImpliedRoot || cdi.hasMultipleRoots) {
v = partialSum;
}
if(v < partialSum * ALMOST_EQUAL) {
failed = true;
return Lib.warn([
'Total value for node', d.data.data.id, 'of', trace.name,
'is smaller than the sum of its children.',
'\nparent value =', v,
'\nchildren sum =', partialSum
].join(' '));
}
}
d.value = v;
});
break;
}
} else {
countDescendants(hierarchy, trace, {
branches: trace.count.indexOf('branches') !== -1,
leaves: trace.count.indexOf('leaves') !== -1
});
}View on GitHub (pinned to 1d090e0b5f)
Solutions
- Recompute the parent value as the sum of its children (or omit the parent's value entirely so Plotly sums it).
- Fix the child values so they sum to the declared parent total.
- If the parent intentionally shows an aggregate cap, split the trace or use branchvalues consistently ('total' vs 'remainder') to match your semantics.
Example fix
// before values: [10, 6, 6] // parent 10 < children sum 12 // after values: [12, 6, 6] // or omit the parent value and let Plotly sum children
Defensive patterns
Strategy: validation
Validate before calling
// ids/parents/values arrays; verify each parent's value >= sum of direct children
function totalsAreConsistent(ids, parents, values) {
const sum = new Map(ids.map(id => [id, 0]));
ids.forEach((id, i) => {
if (parents[i] !== '') sum.set(parents[i], (sum.get(parents[i]) || 0) + values[i]);
});
return ids.every((id, i) =>
!sum.has(id) || sum.get(id) === 0 || values[i] >= sum.get(id));
} Type guard
function parentCoversChildren(ids, parents, values) {
return ids.every((id, i) => {
const kids = ids.reduce((s, _, j) => parents[j] === id ? s + values[j] : s, 0);
return kids === 0 || values[i] >= kids;
});
} Prevention
- Omit explicit values for internal nodes and let Plotly sum children (branchvalues 'remainder').
- If using branchvalues: 'total', assert each parent value equals (or exceeds) its children's sum before plotting.
- Recompute parent totals from leaf data at build time instead of storing them by hand.
When it happens
Trigger: Setting an explicit `values` entry for a parent smaller than the sum of its descendants' values, e.g. parent value 10 with children 6 and 6; also triggered when marker colors/branches use 'remainder' on inconsistent totals.
Common situations: Budget/category data where sub-items were updated but the parent total wasn't; rounding after percentage conversions; mixing explicit parent values with child values computed independently.
Related errors
- Multiple implied roots, cannot build <trace.type> hierarchy
- Failed to build <trace.type> hierarchy of <trace.name>. Erro
- Node <nodeIndex> is already part of a group.
AI-assisted analysis of plotly/plotly.js@1d090e0b5f (2026-09-02).
Data as JSON: /api/errors/105c35bf9c1483ef.
Report an issue: GitHub.