JuliusBrussee/caveman · error · Error

adjacency -> appears in both the hard chain and the…

Error message

${where} adjacency ${edge.from}->${edge.to} appears in both the hard chain and the unproven list

What it means

A causal slice maintains two disjoint edge lists: the proven hard chain and the unproven adjacencies. This error fires when the same edge (identical from, to, and type) appears in both lists, which would let an unproven claim masquerade as proven. The validator rejects the report to keep the two classifications mutually exclusive.

Solutions

  1. Delete the edge from unproven_adjacencies (the hard chain entry wins once it is proven).
  2. If the edge is not actually proven, remove it from hard_edges instead and keep it only in unproven_adjacencies.
  3. Add a pre-submission check that no from/to/type key exists in both arrays.

Example fix

// before
"hard_edges": [{ "from": "a", "to": "b", "type": "causes" }],
"unproven_adjacencies": [{ "from": "a", "to": "b", "type": "causes" }]
// after
"hard_edges": [{ "from": "a", "to": "b", "type": "causes" }],
"unproven_adjacencies": []
Defensive patterns

Strategy: validation

Validate before calling

const hardKeys = new Set(slice.hard_edges.map(e => `${e.from} ${e.to} ${e.type}`));
for (const e of slice.unproven_adjacencies) {
  if (hardKeys.has(`${e.from} ${e.to} ${e.type}`)) throw new Error(`edge ${e.from}->${e.to} in both lists`);
}

Try / catch

try { validateReport(report); } catch (err) { if (String(err.message).includes('appears in both the hard chain and the unproven list')) { /* deduplicate */ } else throw err; }

Prevention

When it happens

Trigger: Running the validator on a report where an entry of unproven_adjacencies is duplicated verbatim in slice.hard_edges (same from/to/type triple).

Common situations: Merging slices from two reports without deduplication; adding a newly proven edge to the hard chain but forgetting to delete its stale entry in the unproven list; template-generated slices with placeholder edges filled into both arrays.

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/6efa04ffabbb2fce. Report an issue: GitHub.

Appendix: source

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

    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") {
      if (item.change_set.operator_id !== "" || item.eval_pack.id !== "" || item.replay.status !== "not_run") {
        throw new Error(`${where} is diagnosis-only but carries a change set, eval pack or replay`);
      }
      continue;
    }
    if (item.change_set.case_id !== item.id || item.eval_pack.case_id !== item.id) {

View on GitHub (pinned to 3ee70a1026)