{"record":{"id":"cea3ae712b107826","repo":"github/spec-kit","slug":"corrupt-records-file-path-bundles-must-be-a","errorCode":null,"errorMessage":"Corrupt records file: {path} — 'bundles' must be a list.","messagePattern":"Corrupt records file: (.+?) — 'bundles' must be a list\\.","errorType":"exception","errorClass":"BundlerError","httpStatus":null,"severity":"error","filePath":"src/specify_cli/bundler/models/records.py","lineNumber":136,"sourceCode":"def load_records(project_root: Path) -> list[InstalledBundleRecord]:\n    # Defense in depth (mirrors the write path's within= confinement): refuse to\n    # read through a symlinked or traversal-escaping ``.specify`` that resolves\n    # outside project_root.\n    path = ensure_within(project_root, records_path(project_root))\n    if not path.exists():\n        return []\n    data = load_json(path)\n    if not isinstance(data, dict):\n        raise BundlerError(f\"Corrupt records file: {path}\")\n    _check_schema_version(data.get(\"schema_version\"), path=path, required=True)\n    bundles = data.get(\"bundles\")\n    if bundles is None:\n        bundles = []\n    elif not isinstance(bundles, list):\n        # `or []` would coerce a FALSY non-list (0, '', False, {}) to [] before\n        # this guard, silently treating a corrupt file as \"no bundles\"; only an\n        # absent/None value means empty.\n        raise BundlerError(\n            f\"Corrupt records file: {path} — 'bundles' must be a list.\"\n        )\n    return [InstalledBundleRecord.from_dict(item) for item in bundles]\n\n\ndef save_records(project_root: Path, records: list[InstalledBundleRecord]) -> None:\n    payload = {\n        \"schema_version\": RECORDS_SCHEMA_VERSION,\n        \"updated_at\": _utc_now(),\n        \"bundles\": [r.to_dict() for r in records],\n    }\n    dump_json(records_path(project_root), payload, within=project_root)\n\n\ndef find_record(\n    records: list[InstalledBundleRecord], bundle_id: str\n) -> InstalledBundleRecord | None:\n    for record in records:","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/github/spec-kit/blob/bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c/src/specify_cli/bundler/models/records.py#L118-L154","documentation":"Error \"Corrupt records file: {path} — 'bundles' must be a list.\" thrown in github/spec-kit.","triggerScenarios":"Thrown at src/specify_cli/bundler/models/records.py:136 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix .specify bundle records file: ensure the 'bundles' value is a JSON list, or delete the corrupt records file and reinstall bundles."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c","analyzedAt":"2026-08-14T19:43:37.150Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}