{"record":{"id":"ea85d39fd85a2b73","repo":"Hmbown/CodeWhale","slug":"missing-kind-path","errorCode":null,"errorMessage":"missing {kind}: {path}","messagePattern":"missing (.+?): (.+?)","errorType":"console","errorClass":"RuntimeContractError","httpStatus":null,"severity":"error","filePath":"scripts/check-runtime-contract-budget.py","lineNumber":164,"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":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/check-runtime-contract-budget.py#L146-L182","documentation":"load_json in check-runtime-contract-budget.py reads a JSON document (a receipt via --receipt or the budget file) and wraps FileNotFoundError in a RuntimeContractError with this message. It means the script was asked to validate a JSON file that does not exist on disk.","triggerScenarios":"Running `check-runtime-contract-budget.py --receipt <path>` where <path> does not exist, or the default budget file scripts/runtime-contract-budget.json being absent from the checkout.","commonSituations":"Typo in the --receipt path; running the script outside the repo root after moving it; a fresh clone or CI job where the receipt artifact was never produced/downloaded; .gitignore deleting the generated receipt.","solutions":["Check the path in the message; run the script from the repo root or pass the correct --receipt path.","If the receipt should exist, generate it first (run the checker without --receipt, or `measure-runtime-contract.py`, possibly with --update).","Restore the missing scripts/runtime-contract-budget.json if it was deleted (git checkout -- scripts/runtime-contract-budget.json)."],"exampleFix":"// before\npython3 scripts/check-runtime-contract-budget.py --receipt reciept.json\n// after\npython3 scripts/check-runtime-contract-budget.py --receipt receipt.json","handlingStrategy":"try-catch","validationCode":"from pathlib import Path\nreceipt = Path(\"receipt.json\")\nif not receipt.is_file():\n    raise SystemExit(f\"receipt not found: {receipt}\")","typeGuard":"def receipt_exists(path) -> bool:\n    from pathlib import Path\n    return Path(path).is_file()","tryCatchPattern":"try:\n    run_checker([\"--receipt\", str(path)])\nexcept RuntimeContractError as e:\n    if str(e).startswith(\"missing\"):\n        generate_receipt(path)  # or fix the path\n    else:\n        raise","preventionTips":["Run the checker from the repository root so relative paths resolve.","Generate the receipt (run without --receipt, or with --update) before trying to validate one.","Never gitignore or clean a receipt you still intend to validate."],"tags":["python","json","file","cli"],"backgroundTag":"file-not-found","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}