Hmbown/CodeWhale · error · RuntimeContractError

receipt metric `representative_context.fixture_id` must be `

Error message

receipt metric `representative_context.fixture_id` must be `{REPRESENTATIVE_FIXTURE_ID}`, got {fixture_id!r}

What it means

validate_receipt requires receipt representative_context.fixture_id to equal the constant REPRESENTATIVE_FIXTURE_ID = "representative-v1". The fixture id pins which synthetic session the byte/token stage measurements were taken against, so receipts measured against a different fixture are incomparable with the budget. The message includes the offending value.

Source

Thrown at scripts/check-runtime-contract-budget.py:267

    validate_document(receipt, RECEIPT_KIND, "receipt")
    skill_discovery = receipt.get("skill_discovery")
    identical = (
        skill_discovery.get("prompts_byte_identical")
        if isinstance(skill_discovery, dict)
        else None
    )
    if identical is not True:
        raise RuntimeContractError(
            "receipt metric `skill_discovery.prompts_byte_identical` must be true"
        )
    representative = receipt.get("representative_context")
    fixture_id = (
        representative.get("fixture_id")
        if isinstance(representative, dict)
        else None
    )
    if fixture_id != REPRESENTATIVE_FIXTURE_ID:
        raise RuntimeContractError(
            "receipt metric `representative_context.fixture_id` must be "
            f"`{REPRESENTATIVE_FIXTURE_ID}`, got {fixture_id!r}"
        )
    representative_identical = representative.get("prompts_byte_identical")
    if representative_identical is not True:
        raise RuntimeContractError(
            "receipt metric `representative_context.prompts_byte_identical` must be true"
        )
    validate_identity_structure(receipt, "receipt")


def validate_budget(budget: dict[str, Any]) -> None:
    validate_document(budget, BUDGET_KIND, "budget")
    representative = budget.get("representative_context")
    fixture_id = (
        representative.get("fixture_id")
        if isinstance(representative, dict)
        else None

View on GitHub (pinned to 8880682c63)

Solutions

  1. Re-measure with the repo's current scripts/measure-runtime-contract.py so the receipt carries representative-v1
  2. If the fixture version truly changed upstream, update both sides together: the constant in the checker and the budget's representative_context.fixture_id (error 207 keeps them in lockstep)
  3. Discard stale receipt files after pulling - the default CLI path measures fresh anyway

Example fix

// before (receipt.json)
"representative_context": { "fixture_id": "representative-v0" }

// after
"representative_context": { "fixture_id": "representative-v1" }
Defensive patterns

Strategy: validation

Validate before calling

EXPECTED_FIXTURE_ID = "representative-v1"


def receipt_fixture_ok(receipt: dict) -> bool:
    rc = receipt.get("representative_context")
    return isinstance(rc, dict) and rc.get("fixture_id") == EXPECTED_FIXTURE_ID

Prevention

When it happens

Trigger: A receipt from a measure-runtime-contract.py version that bumped the fixture (for example a future representative-v2); a hand-crafted receipt reusing another fixture id; a receipt for a different representative harness entirely.

Common situations: Version skew after pulling new code but re-checking an old receipt file; branches that prototype a new representative fixture; copy-pasting a receipt template from docs with a stale id.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16). Data as JSON: /api/errors/ebd9debca56d1d54. Report an issue: GitHub.