JuliusBrussee/caveman · error · Error

hard chain edge -> is not a hard edge of variant

Error message

${where} hard chain edge ${edge.from}->${edge.to} is not a hard edge of variant ${sliceVariant.id}

What it means

The continuous-improvement validator checks every edge listed in a slice's hard chain against the edges declared for the slice's variant. This error means the edge (from,to,type) triple either does not exist in the variant's edge set at all, or exists but with a strength other than "hard". The validator throws it because a hard chain must be built exclusively of edges the variant itself declares as hard.

Solutions

  1. Open the slice's variant and confirm an edge with the exact `${from} ${to} ${type}` key exists and has strength "hard"; fix the edge's from/to/type to match.
  2. If the dependency is real but weaker than hard, remove it from the hard chain and move it to slice.unproven_adjacencies.
  3. If the edge was recently removed or re-typed in the variant, regenerate or update the slice's hard_edges to reflect the current variant.

Example fix

// before (slice hard edge)
{ "from": "ingest", "to": "parse", "type": "follows", "strength": "hard" }
// variant declares type "causes"
// after
{ "from": "ingest", "to": "parse", "type": "causes", "strength": "hard" }
Defensive patterns

Strategy: validation

Validate before calling

const variantEdgeKeys = new Set(sliceVariant.edges.filter(e => e.strength === 'hard').map(e => `${e.from} ${e.to} ${e.type}`));
for (const e of slice.hard_edges) {
  if (!variantEdgeKeys.has(`${e.from} ${e.to} ${e.type}`)) throw new Error(`hard edge ${e.from}->${e.to} (${e.type}) not a hard edge of ${sliceVariant.id}`);
}

Try / catch

try { validateReport(report); } catch (err) { if (String(err.message).includes('is not a hard edge of variant')) { /* fix slice hard_edges against variant */ } else throw err; }

Prevention

When it happens

Trigger: Running validate-continuous-improvement.mjs on a report whose causal slice `hard_edges` (the chain) contains an edge with a from/to/type combination not present in the slice variant's edge list, or present with strength "weak"/"soft" instead of "hard".

Common situations: Hand-authored slice JSON where the chain edge type (e.g. "causes" vs "follows") does not exactly match the variant's declared type; an edge was downgraded to a non-hard strength in the variant but the chain was not updated; typos in node IDs so the key `from to type` misses in the variantEdges map.

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


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/56ee83953e047c29. Report an issue: GitHub.

Appendix: source

Thrown at packages/shared/contracts/scripts/validate-continuous-improvement.mjs:197

    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`);
      }
    }

    // A case that proposes nothing must carry nothing: no operator, no eval
    // pack, no replay. Anything else would present an abstention as a proposal.
    if (item.status === "diagnosis_only") {

View on GitHub (pinned to 3ee70a1026)