JuliusBrussee/caveman · error · Error
${where} causal slice is not taken from the baseline arm's v
Error message
${where} causal slice is not taken from the baseline arm's variant What it means
The causal slice must be taken from the baseline arm's variant: the resolved slice variant's id must equal armVariants.get('baseline').id (validate-continuous-improvement.mjs:174). The slice explains where the investigated failure manifests in the current (baseline) workflow; slicing the alternative variant would explain a workflow that was not the subject of the diagnosis.
Source
Thrown at packages/shared/contracts/scripts/validate-continuous-improvement.mjs:174
}
const selectedPerArm = new Map();
for (const trace of item.representative_traces) {
const variant = armVariants.get(trace.arm);
if (!variant || variant.id !== trace.variant_id) throw new Error(`${where} representative trace names a variant that is not that arm's variant`);
if (!unitsByID.has(trace.analysis_unit_id)) throw new Error(`${where} representative trace ${trace.analysis_unit_id} is not an analysis unit of this report`);
if (!familyUnits.has(trace.analysis_unit_id)) throw new Error(`${where} representative trace ${trace.analysis_unit_id} is not a member of the cohort's task family`);
if (!variant.analysis_unit_ids.includes(trace.analysis_unit_id)) throw new Error(`${where} representative trace ${trace.analysis_unit_id} did not run that arm's workflow variant`);
selectedPerArm.set(trace.arm, (selectedPerArm.get(trace.arm) ?? 0) + 1);
}
for (const [arm, count] of selectedPerArm) {
if (count > 3) throw new Error(`${where} arm ${arm} carries ${count} representative traces, more than three`);
}
const slice = item.causal_slice;
const sliceVariant = variantsByID.get(slice.variant_id);
if (!sliceVariant) throw new Error(`${where} causal slice references a workflow variant that is not in this report`);
if (sliceVariant.id !== armVariants.get("baseline").id) throw new Error(`${where} causal slice is not taken from the baseline arm's variant`);
const sliceNodes = new Set(sliceVariant.nodes.map((node) => node.id));
if (slice.manifestation_node_id !== "" && !sliceNodes.has(slice.manifestation_node_id)) {
throw new Error(`${where} manifestation node ${slice.manifestation_node_id} is not a node of variant ${sliceVariant.id}`);
}
if (item.diagnosis.manifestation.node_id !== slice.manifestation_node_id) {
throw new Error(`${where} diagnosis manifestation node disagrees with its causal slice`);
}
for (const nodeID of slice.node_chain) {
if (!sliceNodes.has(nodeID)) throw new Error(`${where} causal slice node ${nodeID} is not a node of variant ${sliceVariant.id}`);
}
if (slice.manifestation_node_id !== "" && !slice.node_chain.includes(slice.manifestation_node_id)) {
throw new Error(`${where} causal slice omits its own manifestation node`);
}
const provenDependency = (edge) => edge.strength === "hard" && (edge.type === "data" || edge.type === "control") && edge.evidence_refs.length > 0;
const variantEdges = new Map(sliceVariant.edges.map((edge) => [`${edge.from} ${edge.to} ${edge.type}`, edge]));
for (const edge of slice.hard_edges) {
if (!provenDependency(edge)) throw new Error(`${where} hard chain carries an unproven edge ${edge.from}->${edge.to}`);
if (!sliceNodes.has(edge.from) || !sliceNodes.has(edge.to)) throw new Error(`${where} hard chain edge ${edge.from}->${edge.to} names a node outside variant ${sliceVariant.id}`);View on GitHub (pinned to 766dce6b13)
Solutions
- Point causal_slice.variant_id at whatever variant the baseline arm names.
- Fix arm ordering first if error 604 also fires — it changes which variant 'baseline' resolves to.
- Re-run the validator; node and edge checks (615-619) run against the corrected slice.
Example fix
// before — baseline arm uses wf-build-01
"causal_slice": { "variant_id": "wf-build-02", ... }
// after
"causal_slice": { "variant_id": "wf-build-01", ... } Defensive patterns
Strategy: validation
Validate before calling
const nonBaselineSlices = (report) =>
report.cases.filter((c) => {
const baseline = c.cohort.arms.find((a) => a.role === 'baseline');
return c.causal_slice.variant_id !== baseline?.variant_id;
}).map((c) => c.id); Try / catch
try {
execFileSync(process.execPath, [VALIDATOR, reportPath, spansPath]);
} catch (err) {
if (/not taken from the baseline/.test(err.message)) {
failCI(`slice must come from the baseline arm's variant: ${err.message}`);
} else throw err;
} Prevention
- Always slice the current (baseline) workflow, even when the alternative is more interesting.
- Fix arm ordering (error 604) before debugging slice checks.
- Compute slice.variant_id from the baseline arm lookup so it cannot drift.
When it happens
Trigger: causal_slice.variant_id points at the alternative variant; the arms were swapped (error 604) so 'baseline' now resolves to the other variant; the slice block was cloned from a case with a different baseline.
Common situations: Building the slice from the 'interesting' new variant instead of the current one; refactors that reorder arms; copy-paste between cases in multi-variant fixtures.
Related errors
- ${where} diagnosis manifestation node disagrees with its cau
- ${where} representative trace names a variant that is not th
- ${where} causal slice references a workflow variant that is
- ${where} manifestation node ${slice.manifestation_node_id} i
- ${where} causal slice node ${nodeID} is not a node of varian
AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18).
Data as JSON: /api/errors/39f50a685529f722.
Report an issue: GitHub.