{"record":{"id":"73ae17fc90fd7956","repo":"unslothai/unsloth","slug":"the-pinned-spec-name-archive-contains-an-unreada","errorCode":null,"errorMessage":"The pinned {spec.name} archive contains an unreadable file","messagePattern":"The pinned (.+?) archive contains an unreadable file","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"studio/backend/utils/third_party_source.py","lineNumber":676,"sourceCode":"                                    f\"The pinned {spec.name} archive contains a non-regular file\"\n                                )\n                            uncompressed_bytes += member.size\n                            if uncompressed_bytes > _ARCHIVE_MAX_UNCOMPRESSED_BYTES:\n                                raise RuntimeError(\n                                    f\"The pinned {spec.name} archive expands too large\"\n                                )\n                            if len(parts) < 3 or parts[1] != spec.package:\n                                continue\n                            relative = \"/\".join(parts[1:])\n                            _package_path_parts(relative, spec, kind = \"archive\")\n                            if relative in extracted:\n                                raise RuntimeError(\n                                    f\"The pinned {spec.name} archive contains duplicate files\"\n                                )\n                            extracted.add(relative)\n                            source_file = bundle.extractfile(member)\n                            if source_file is None:\n                                raise RuntimeError(\n                                    f\"The pinned {spec.name} archive contains an unreadable file\"\n                                )\n                            destination_file = staging.joinpath(*parts[1:])\n                            destination_file.parent.mkdir(parents = True, exist_ok = True)\n                            remaining = member.size\n                            with source_file, destination_file.open(\"wb\") as handle:\n                                while remaining:\n                                    chunk = source_file.read(min(1024 * 1024, remaining))\n                                    if not chunk:\n                                        raise RuntimeError(\n                                            f\"The pinned {spec.name} archive ended unexpectedly\"\n                                        )\n                                    handle.write(chunk)\n                                    remaining -= len(chunk)\n        except (tarfile.TarError, EOFError, OSError) as error:\n            raise RuntimeError(f\"The pinned {spec.name} source archive is invalid\") from error\n        if _sealed_source_manifest(staging, spec) is None:\n            raise RuntimeError(f\"The pinned {spec.name} source archive failed integrity validation\")","sourceCodeStart":658,"sourceCodeEnd":694,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/utils/third_party_source.py#L658-L694","documentation":"After validation, the installer calls bundle.extractfile(member); for a non-regular member (or a member that cannot be exposed as a stream in r| mode) tarfile returns None instead of raising. This guard converts that silent None into an explicit error so the copy loop never dereferences a missing stream.","triggerScenarios":"bundle.extractfile(member) returns None for a member that passed earlier checks — in practice rare, occurring with unusual member types, stream-mode (r|) limitations, or corrupt headers where extractfile cannot produce a file object.","commonSituations":"Corrupt/truncated archive where headers claim a regular file but no data stream follows; unusual tar formats (sparse/pcrl special records) that tarfile lists but cannot extract in stream mode; usually accompanies a broader integrity failure (see 1593/1595).","solutions":["Validate the archive locally: gzip -t source.tar.gz && tar -tzf source.tar.gz > /dev/null to detect corruption","Re-download the archive (the temp workspace is discarded on failure) — truncated transfers sometimes produce this shape","Repack from the canonical revision export and re-pin","Verify SHA-256 of the downloaded file against the expected artifact digest"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import tarfile\nwith tarfile.open(\"source.tar.gz\") as tf:\n    for m in tf:\n        if m.isfile() and tf.extractfile(m) is None:\n            raise SystemExit(f\"member unreadable in stream: {m.name}\")","typeGuard":null,"tryCatchPattern":"try:\n    ensure_pinned_source(spec)\nexcept RuntimeError as e:\n    if \"unreadable file\" in str(e):\n        runtime = ensure_pinned_source(spec)  # fresh download into a new temp workspace","preventionTips":["Verify gzip integrity (gzip -t) of downloaded archives in CI before pinning","Avoid hand-rolled tar transformations; use git archive or tar from a clean checkout"],"tags":["tarfile","extraction","corrupt-archive","streaming"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}