{"record":{"id":"238ebc586312c9e7","repo":"github/spec-kit","slug":"downloaded-artifact-for-bundle-entry-id-from-238ebc","errorCode":null,"errorMessage":"Downloaded artifact for bundle '{entry_id}' from {_source_desc} is not a valid bundle.","messagePattern":"Downloaded artifact for bundle '(.+?)' from (.+?) is not a valid bundle\\.","errorType":"exception","errorClass":"BundlerError","httpStatus":null,"severity":"error","filePath":"src/specify_cli/commands/bundle/__init__.py","lineNumber":1035,"sourceCode":"                artifact = Path(tmp) / \"bundle.zip\"\n                artifact.write_bytes(raw)\n                # Wrap ZIP parsing so any failure (BadZipFile, missing\n                # bundle.yml, etc.) references the source URL rather than the\n                # opaque temporary path, consistent with the download-error\n                # handling above.\n                try:\n                    manifest = _local_manifest_source(str(artifact))\n                except Exception as exc:  # noqa: BLE001\n                    raise BundlerError(\n                        f\"Downloaded artifact for bundle '{entry_id}' from \"\n                        f\"{_source_desc} is not a valid bundle: {exc}\"\n                    ) from exc\n                # _local_manifest_source returns None only when the file does\n                # not exist; since we just wrote *artifact* that cannot happen\n                # here.  The explicit guard ensures callers never receive None\n                # and silently degrade instead of raising a clear error.\n                if manifest is None:\n                    raise BundlerError(\n                        f\"Downloaded artifact for bundle '{entry_id}' from \"\n                        f\"{_source_desc} is not a valid bundle.\"\n                    )\n                return manifest\n\n        data = _yaml.safe_load(io.BytesIO(raw))\n        return BundleManifest.from_dict(data)\n    except BundlerError:\n        raise\n    except _yaml.YAMLError as exc:\n        raise BundlerError(\n            f\"Downloaded content for bundle '{entry_id}' from {_source_desc} \"\n            f\"is not valid YAML: {exc}\"\n        ) from exc\n    except Exception as exc:  # noqa: BLE001\n        raise BundlerError(\n            f\"Failed to parse downloaded bundle '{entry_id}' from \"\n            f\"{_source_desc}: {exc}\"","sourceCodeStart":1017,"sourceCodeEnd":1053,"githubUrl":"https://github.com/github/spec-kit/blob/bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c/src/specify_cli/commands/bundle/__init__.py#L1017-L1053","documentation":"This is a defensive invariant guard: after Spec Kit writes the downloaded ZIP to a temporary file, the local manifest reader should never return None. None normally means the file does not exist, so this error marks an impossible/racy state rather than a normal user-input failure.","triggerScenarios":"The temporary `bundle.zip` disappears or reports non-existence between write_bytes and _local_manifest_source, or internal code/monkeypatching breaks the documented contract. Normal malformed ZIP errors take the preceding exception branch instead.","commonSituations":"Essentially not reached in normal use. A hypothetical trigger is an external process or antivirus removing the temporary file, a broken temp filesystem, or patched internal functions.","solutions":["Retry the bundle command once to rule out a transient temporary-directory race.","Check TEMP/TMP permissions and free disk space if it recurs.","Capture the exact command, catalog entry, and environment and report it as a Spec Kit defect because this branch is designed to be unreachable."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"except BundlerError as exc:\n    if \"is not a valid bundle.\" in str(exc) and str(exc).endswith(\"bundle.\"):\n        collect_diagnostics_and_report_bug()\n    else:\n        raise","preventionTips":["Do not write automated workarounds for this defensive branch; treat it as an invariant violation.","Keep TEMP/TMP on a reliable local filesystem.","Capture command, catalog URL, and traceback when it occurs so maintainers can diagnose the race."],"tags":["internal","defensive","bundle","zip","temp-files"],"backgroundTag":null,"analyzedSha":"bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c","analyzedAt":"2026-08-14T19:43:37.150Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}