JuliusBrussee/caveman · error · Error
causal slice node is not a node of variant
Error message
${where} causal slice node ${nodeID} is not a node of variant ${sliceVariant.id} What it means
Validation error in the continuous-improvement contract validator: a causal slice in the report names a node id that is not a member of the variant the slice claims to be taken from. The slice is therefore not a faithful subgraph of that variant's graph.
Solutions
- Remove or correct the offending node id in node_chain
- Regenerate node_chain from the current variant's graph
- Pin the report fixture to the variant revision the chain was authored against
Example fix
// before node_chain: ['node_1', 'node_2', 'node_renamed_3'] // after node_chain: ['node_1', 'node_2', 'node_3']
Defensive patterns
Strategy: validation
Validate before calling
const nodeIds = new Set(variant.nodes.map(n => n.id));
const bad = slice.node_chain.filter(id => !nodeIds.has(id));
if (bad.length) throw new Error(`chain nodes not in variant: ${bad}`); Type guard
const chainInVariant = (slice, variant) => slice.node_chain.every(id => variant.nodes.some(n => n.id === id));
Try / catch
try { validateCase(item); } catch (e) { if (String(e.message).includes('is not a node of variant')) rebuildNodeChain(item); else throw e; } Prevention
- Build node_chain by walking the variant graph, never by hand
- Rebuild slices after variant graph refactors
- Add a fixture lint that checks all referenced ids against the graph
When it happens
Trigger: `slice.node_chain` contains a node id not present in `sliceVariant.nodes` while validating the report.
Common situations: Chain authored from an older variant revision; hallucinated/typo'd node ids in an LLM-generated slice; variant graph refactored after the slice was written.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- hard chain edge -> names a node outside variant
- manifestation node is not a node of variant
- apiKey, baseURL, and agent are required
- arm must be or
- artifact_id is required
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/da1047bfd0963d83.
Report an issue: GitHub.
Appendix: source
Thrown at packages/shared/contracts/scripts/validate-continuous-improvement.mjs:183
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}`);
if (!slice.node_chain.includes(edge.from) || !slice.node_chain.includes(edge.to)) {
throw new Error(`${where} hard chain edge ${edge.from}->${edge.to} is outside the slice's node chain`);
}
const source = variantEdges.get(`${edge.from} ${edge.to} ${edge.type}`);
if (!source || source.strength !== "hard") throw new Error(`${where} hard chain edge ${edge.from}->${edge.to} is not a hard edge of variant ${sliceVariant.id}`);
}
for (const edge of slice.unproven_adjacencies) {
// The whole point of the separate list: nothing in it may read as proven.
if (provenDependency(edge)) throw new Error(`${where} unproven adjacency ${edge.from}->${edge.to} is in fact a proven hard dependency`);View on GitHub (pinned to 3ee70a1026)