affaan-m/ECC · error · ValueError

historical evidence does not bind the candidate…

Error message

historical evidence does not bind the candidate source/input/bytes

What it means

The generation_receipt is not just present — it must bind this exact candidate: source_sha256, compiled_input_sha256, candidate_sha256 (of the media bytes), and source_url in the receipt must match the values TasteForge computes from the bundle context and the candidate's media. Any mismatch means the receipt belongs to a different request/asset, so the candidate's provenance chain is broken.

Solutions

  1. Regenerate the candidate (or re-issue its receipt) so the receipt's source_sha256, compiled_input_sha256, candidate_sha256, and source_url all match the current values
  2. Do not modify candidate media after generation; if post-processing is required, regenerate and obtain a new receipt
  3. Match receipts to candidates programmatically by candidate_sha256 instead of by file order or name

Example fix

// before
receipt.candidate_sha256 = "aaa111"  # receipt from another candidate
// after
receipt.candidate_sha256 = candidate.media.sha256  # e.g. "bbb222"
Defensive patterns

Strategy: validation

Validate before calling

function assertReceiptBinding(c, ctx) {
  const expected = {
    source_sha256: ctx.sourceHash,
    compiled_input_sha256: ctx.inputHash,
    candidate_sha256: c.media.sha256,
    source_url: ctx.sourceUrl,
  };
  for (const [k, v] of Object.entries(expected))
    if (c.generation_receipt?.[k] !== v)
      throw new Error(`receipt field ${k} does not bind candidate ${c.id}`);
}

Try / catch

try {
  buildApplicationBundle(cfg);
} catch (e) {
  if (e.message.includes("does not bind the candidate")) {
    cfg.candidates = cfg.candidates.filter(c => receiptBinds(c, cfg)); // drop misbound entries
    return buildApplicationBundle(cfg);
  }
  throw e;
}

Prevention

When it happens

Trigger: Swapping the candidate's media bytes after generation without updating the receipt (candidate_sha256 mismatch); reusing a receipt from another candidate; editing the input or source after generation so the receipt's recorded hashes no longer match the current bundle hashes; a wrong source_url recorded.

Common situations: Manual media replacement (re-encode, trim, color-grade) post-generation; receipt/candidate files mixed up when moving between machines; parallel generation runs whose receipts got cross-assigned.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/c2c0fb59997477bb. Report an issue: GitHub.

Appendix: source

Thrown at skills/taste-application/scripts/tasteforge/integration.py:305

        if name in result:
            raise ValueError("candidate ids must be unique")
        _artifact(item["media"])
        _integer(item["media_frames"], 1)
        _rate(item["fps"])
        if item["origin"] != "provider_generated" or item["relationship"] != "generated_variation":
            raise ValueError("a generated candidate cannot claim original-source identity")
        if item["source_sha256"] != source_hash or item["compiled_input_sha256"] != input_hash:
            raise ValueError("candidate is bound to a different source or input")
        if item["review_status"] not in ("pending", "rejected", "approved"):
            raise ValueError("explicit candidate review state required")
        evidence = _artifact(item["generation_receipt"], parse_json=True)
        if not isinstance(evidence, dict) or not isinstance(evidence.get("request_id"), str):
            raise ValueError("historical request evidence required")
        _text(evidence["request_id"])
        expected = {"source_sha256": source_hash, "compiled_input_sha256": input_hash,
                    "candidate_sha256": item["media"]["sha256"], "source_url": source_url}
        if any(evidence.get(key) != value for key, value in expected.items()):
            raise ValueError("historical evidence does not bind the candidate source/input/bytes")
        result[name] = item
    return result


def _inserts(items: list, candidates: dict, config: dict, input_hash: str, edit_hash: str) -> None:
    occupied = []
    for item in items:
        _object(item, {"candidate_id", "candidate_range", "timeline_range", "retime", "approval_file"})
        candidate = candidates.get(_text(item["candidate_id"]))
        if candidate is None or candidate["review_status"] != "approved":
            raise ValueError("insert requires an approved, resolved candidate")
        target = _range(item["timeline_range"], config["baseline"]["timeline_range"])
        source = _range(item["candidate_range"], [0, candidate["media_frames"]])
        if any(_overlap(target, p["range"]) for p in config["protected_intervals"]):
            raise ValueError("insert overlaps protected original stack")
        if any(_overlap(target, span) for span in occupied):
            raise ValueError("insert proposals overlap")
        if (item["retime"] != "none" or target[1] - target[0] != source[1] - source[0]

View on GitHub (pinned to 8321021c54)