JuliusBrussee/caveman · error · Error
hard chain edge -> is outside the slice's node chain
Error message
${where} hard chain edge ${edge.from}->${edge.to} is outside the slice's node chain What it means
Hard-chain edges must lie entirely within the slice's declared node_chain, not merely within the variant. An edge touching a node outside `slice.node_chain` means the chain and the hard edges describe different subgraphs, so validation throws.
Solutions
- Add the missing endpoint node ids to slice.node_chain
- Remove the out-of-chain edge from hard_edges (or move it to unproven_adjacencies)
- Regenerate chain and hard_edges together from one slice extraction run
Example fix
// before
node_chain: ['node_1','node_2'], hard_edges: [{from:'node_2',to:'node_5',...}]
// after
node_chain: ['node_1','node_2','node_5'], hard_edges: [{from:'node_2',to:'node_5',...}] Defensive patterns
Strategy: validation
Validate before calling
const chain = new Set(slice.node_chain);
const bad = slice.hard_edges.filter(e => !chain.has(e.from) || !chain.has(e.to));
if (bad.length) throw new Error(`edges outside node chain: ${bad.map(e => e.from + '->' + e.to)}`); Type guard
const edgesInChain = (slice) => { const c = new Set(slice.node_chain); return slice.hard_edges.every(e => c.has(e.from) && c.has(e.to)); }; Try / catch
try { validateCase(item); } catch (e) { if (String(e.message).includes("outside the slice's node chain")) extendChainOrPruneEdges(item); else throw e; } Prevention
- Generate node_chain and hard_edges in the same extraction pass
- Never edit chain and edges independently
- Add a consistency check to the fixture authoring script
When it happens
Trigger: `slice.hard_edges` contains an edge where `from` or `to` is absent from `slice.node_chain` (even though it exists in the variant).
Common situations: Adding an edge to the hard chain without extending node_chain; chain pruned after edges were authored; two authors editing chain and edges independently.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- causal slice omits its own manifestation node
- diagnosis manifestation node disagrees with its causal slice
- representative trace names a variant that is not that arm's…
- representative trace did not run that arm's workflow variant
- apiKey, baseURL, and agent are required
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/939f08a2b8b3c8c0.
Report an issue: GitHub.
Appendix: source
Thrown at packages/shared/contracts/scripts/validate-continuous-improvement.mjs:194
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`);
if (slice.hard_edges.some((hard) => hard.from === edge.from && hard.to === edge.to && hard.type === edge.type)) {
throw new Error(`${where} adjacency ${edge.from}->${edge.to} appears in both the hard chain and the unproven list`);
}
}
const upstream = new Set(item.diagnosis.root_cause_hypothesis.upstream_node_ids);
for (const nodeID of upstream) {
if (!slice.node_chain.includes(nodeID) || nodeID === slice.manifestation_node_id) {
throw new Error(`${where} diagnosis upstream node ${nodeID} is not an upstream node of its causal slice`);
}
}
View on GitHub (pinned to 3ee70a1026)