Hmbown/CodeWhale · error · RuntimeContractError

budget metric `representative_context.fixture_id` must be `{

Error message

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

What it means

validate_budget requires scripts/runtime-contract-budget.json to carry representative_context.fixture_id == "representative-v1" (REPRESENTATIVE_FIXTURE_ID). The budget and the receipt must be measured against the same fixture for the ceilings and stage digests to mean anything, so the checker refuses budgets pinned to a different fixture. Mirrors error 205 on the budget side.

Source

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

        )
    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
    )
    if fixture_id != REPRESENTATIVE_FIXTURE_ID:
        raise RuntimeContractError(
            "budget metric `representative_context.fixture_id` must be "
            f"`{REPRESENTATIVE_FIXTURE_ID}`, got {fixture_id!r}"
        )
    validate_identity_structure(budget, "budget")


def metric_value(document: dict[str, Any], path: MetricPath, kind: str) -> int:
    value = required_value(document, path, kind)
    dotted = ".".join(path)
    if isinstance(value, bool) or not isinstance(value, int) or value < 0:
        raise RuntimeContractError(
            f"{kind} metric `{dotted}` must be a non-negative integer"
        )
    return value


def compare(
    receipt: dict[str, Any], budget: dict[str, Any]

View on GitHub (pinned to 8880682c63)

Solutions

  1. Set representative_context.fixture_id to "representative-v1" in the budget file
  2. If the fixture version legitimately changed, regenerate the whole budget from a fresh receipt (python3 scripts/check-runtime-contract-budget.py --update once compare passes) rather than editing the id alone
  3. Verify you are pointing --budget at the repo's scripts/runtime-contract-budget.json

Example fix

// before (scripts/runtime-contract-budget.json)
"representative_context": { "fixture_id": "representative-v2" }

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

Strategy: validation

Validate before calling

EXPECTED_FIXTURE_ID = "representative-v1"


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

Prevention

When it happens

Trigger: Loading a --budget file whose fixture_id was bumped or hand-edited; reusing a budget from a branch that introduced a new representative fixture; merging a budget file that dropped representative_context entirely (then the value is None).

Common situations: Carrying an old budget forward after a fixture-version bump without re-measuring; passing a custom --budget path pointing at another project's file.

Related errors


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