{"record":{"id":"04eb2acf5237110d","repo":"github/spec-kit","slug":"corrupt-records-file-record-for-bundle-bundle-i","errorCode":null,"errorMessage":"Corrupt records file: record for bundle '{bundle_id}' is missing its 'version'.","messagePattern":"Corrupt records file: record for bundle '(.+?)' is missing its 'version'\\.","errorType":"exception","errorClass":"BundlerError","httpStatus":null,"severity":"error","filePath":"src/specify_cli/bundler/models/records.py","lineNumber":76,"sourceCode":"        components_raw = data.get(\"contributed_components\")\n        if components_raw is None:\n            components_raw = []\n        elif not isinstance(components_raw, list):\n            # `or []` would coerce a FALSY non-list (0, '', False, {}) to []\n            # before this guard, silently accepting a corrupt record; only an\n            # absent/None value means \"no components\".\n            raise BundlerError(\n                \"Corrupt record: 'contributed_components' must be a list.\"\n            )\n        bundle_id = str(data.get(\"bundle_id\", \"\")).strip()\n        version = str(data.get(\"version\", \"\")).strip()\n        if not bundle_id:\n            raise BundlerError(\n                \"Corrupt records file: an installed-bundle record is missing \"\n                \"its 'bundle_id'.\"\n            )\n        if not version:\n            raise BundlerError(\n                f\"Corrupt records file: record for bundle '{bundle_id}' is \"\n                \"missing its 'version'.\"\n            )\n        return cls(\n            bundle_id=bundle_id,\n            version=version,\n            installed_at=str(data.get(\"installed_at\", \"\")).strip(),\n            contributed_components=tuple(\n                _component_from_dict(c) for c in components_raw\n            ),\n        )\n\n\ndef records_path(project_root: Path) -> Path:\n    return Path(project_root) / \".specify\" / RECORDS_FILENAME\n\n\ndef _check_schema_version(value: Any, *, path: Path, required: bool) -> None:","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/github/spec-kit/blob/bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c/src/specify_cli/bundler/models/records.py#L58-L94","documentation":"Raised by InstalledBundleRecord.from_dict when a record has a valid bundle_id but no usable 'version' (missing, null, or whitespace-only). The version is needed to detect upgrades/downgrades and to attribute installed components, so the record is rejected as corrupt, naming the bundle in the message.","triggerScenarios":"A records-file entry contains \"bundle_id\": \"my-bundle\" but no version key, or \"version\": \"\". The second falsy check after bundle_id validation raises.","commonSituations":"Hand-adding a record while assuming version is optional; stripping fields to shrink the file; older writers that omitted version.","solutions":["Set 'version' to the installed bundle's version string (must match the manifest, e.g. \"1.0.0\").","Remove the record entirely and reinstall the bundle to regenerate correct state."],"exampleFix":"// before\n{\"bundle_id\": \"my-bundle\", \"installed_at\": \"...\"}\n\n// after\n{\"bundle_id\": \"my-bundle\", \"version\": \"1.0.0\", \"installed_at\": \"...\"}","handlingStrategy":"validation","validationCode":"def record_has_version(record: dict) -> bool:\n    return bool(str(record.get(\"version\", \"\")).strip())","typeGuard":"def is_valid_record(record: object) -> bool:\n    return (\n        isinstance(record, dict)\n        and bool(str(record.get(\"bundle_id\", \"\")).strip())\n        and bool(str(record.get(\"version\", \"\")).strip())\n    )","tryCatchPattern":"try:\n    records = load_records(project_root)\nexcept BundlerError as e:\n    if \"missing its 'version'\" in str(e):\n        # set version to the installed manifest version, or drop the record\n        ...","preventionTips":["version is mandatory on every record and should match the bundle manifest.","After manual cleanup, run 'specify bundle list' to re-validate the file."],"tags":["bundler","records","json","validation","corruption"],"backgroundTag":null,"analyzedSha":"bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c","analyzedAt":"2026-08-14T19:43:37.150Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}