{"record":{"id":"ea85d39fd85a2b73","repo":"Hmbown/CodeWhale","slug":"missing-kind-path","errorCode":null,"errorMessage":"missing {kind}: {path}","messagePattern":"missing (.+?): (.+?)","errorType":"exception","errorClass":"RuntimeContractError","httpStatus":null,"severity":"error","filePath":"scripts/check-runtime-contract-budget.py","lineNumber":163,"sourceCode":"    *(\n        (\n            (\"representative_context\", \"stages\", stage, \"identity_sha256\"),\n            f\"representative {label} stage identity digest\",\n        )\n        for stage, label in REPRESENTATIVE_STAGES\n    ),\n)\n\n\nclass RuntimeContractError(ValueError):\n    \"\"\"A receipt or budget is missing a required, well-typed metric.\"\"\"\n\n\ndef load_json(path: Path, kind: str) -> dict[str, Any]:\n    try:\n        document = json.loads(path.read_text(encoding=\"utf-8\"))\n    except FileNotFoundError as error:\n        raise RuntimeContractError(f\"missing {kind}: {path}\") from error\n    except (OSError, json.JSONDecodeError) as error:\n        raise RuntimeContractError(f\"invalid {kind} {path}: {error}\") from error\n    if not isinstance(document, dict):\n        raise RuntimeContractError(f\"invalid {kind} {path}: top level must be an object\")\n    return document\n\n\ndef validate_document(\n    document: dict[str, Any], expected_kind: str, source: str\n) -> None:\n    actual_kind = document.get(\"document_kind\")\n    if actual_kind != expected_kind:\n        raise RuntimeContractError(\n            f\"{source} document_kind must be `{expected_kind}`, got {actual_kind!r}\"\n        )\n    version = document.get(\"schema_version\")\n    if (\n        isinstance(version, bool)","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/scripts/check-runtime-contract-budget.py#L145-L181","documentation":"load_json in scripts/check-runtime-contract-budget.py caught FileNotFoundError while reading the receipt or budget path. The checker needs scripts/runtime-contract-budget.json and, when --receipt is passed, the measurement receipt to exist before validation. The message echoes the exact missing path and its kind (receipt or budget).","triggerScenarios":"Passing --receipt with a typo'd or non-existent path; deleting scripts/runtime-contract-budget.json; running in a checkout that lacks the checked-in budget; using a relative path from the wrong working directory.","commonSituations":"Typos in CI invocations; fresh clones or partial checkouts missing files; scripts run outside the repository root.","solutions":["Check the path in the message with ls and fix typos — --receipt paths are resolved relative to where you invoke the script","Generate a receipt first: run `python3 scripts/check-runtime-contract-budget.py` without --receipt, or run scripts/measure-runtime-contract.py","Restore a deleted budget from git: `git checkout -- scripts/runtime-contract-budget.json`"],"exampleFix":"# before\npython3 scripts/check-runtime-contract-budget.py --receipt recipt.json  # typo\n# after\npython3 scripts/check-runtime-contract-budget.py --receipt receipt.json","handlingStrategy":"validation","validationCode":"from pathlib import Path\nassert Path('scripts/runtime-contract-budget.json').is_file()\nassert receipt_path.is_file(), receipt_path","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate paths before invoking the checker","Generate receipts with the measure script instead of referencing stale files","Use repo-root-relative paths in CI invocations"],"tags":["python","file-not-found","json","ci"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}