{"record":{"id":"54defe680f89d53e","repo":"unslothai/unsloth","slug":"could-not-download-the-pinned-spec-name-source-a","errorCode":null,"errorMessage":"Could not download the pinned {spec.name} source archive","messagePattern":"Could not download the pinned (.+?) source archive","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"studio/backend/utils/third_party_source.py","lineNumber":596,"sourceCode":"                    if time.monotonic() >= deadline:\n                        raise RuntimeError(\n                            f\"Timed out downloading the pinned {spec.name} source archive\"\n                        )\n                    chunk = read_chunk(1024 * 1024)\n                    if time.monotonic() >= deadline:\n                        raise RuntimeError(\n                            f\"Timed out downloading the pinned {spec.name} source archive\"\n                        )\n                    if not chunk:\n                        break\n                    total += len(chunk)\n                    if total > _ARCHIVE_MAX_DOWNLOAD_BYTES:\n                        raise RuntimeError(f\"The pinned {spec.name} archive is too large\")\n                    handle.write(chunk)\n    except RuntimeError:\n        raise\n    except (OSError, urllib.error.URLError) as error:\n        raise RuntimeError(f\"Could not download the pinned {spec.name} source archive\") from error\n\n\ndef _archive_member_parts(member: tarfile.TarInfo, spec: PinnedSource) -> tuple[str, ...]:\n    name = member.name[:-1] if member.isdir() and member.name.endswith(\"/\") else member.name\n    parts = tuple(name.split(\"/\"))\n    if (\n        not name\n        or name.startswith(\"/\")\n        or \"\\\\\" in name\n        or any(part in (\"\", \".\", \"..\") for part in parts)\n        or any(PureWindowsPath(part).drive for part in parts)\n        or parts[0] != _archive_root_name(spec)\n    ):\n        raise RuntimeError(f\"Invalid path in the pinned {spec.name} source archive\")\n    return parts\n\n\nclass _BoundedArchiveReader:","sourceCodeStart":578,"sourceCodeEnd":614,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/utils/third_party_source.py#L578-L614","documentation":"Catch-all translation at the end of _download_archive: any OSError or urllib.error.URLError raised during the HTTP request/transfer is re-raised as RuntimeError with this message (chained via `from error`). The library normalizes all transport-level failures — DNS failure, connection refused, TLS errors, HTTP error responses surfaced as URLError subclasses — into one deterministic exception type.","triggerScenarios":"urllib.request.urlopen raised: DNS resolution failure for the archive host, connection refused/reset mid-transfer, TLS certificate verification failure, or an HTTPError (404/403/5xx) for archive_url. Any of these escapes the loop and hits `except (OSError, urllib.error.URLError)`.","commonSituations":"Offline or firewalled CI without egress to the archive host; expired/rotated URL (GitHub archive URLs can disappear); corporate TLS-intercepting proxy with an untrusted CA; typo in archive_url; rate-limited (403) by the CDN.","solutions":["Inspect the chained cause: `except RuntimeError as e: print(e.__cause__)` reveals the underlying URLError/OSError and its reason","Verify the URL responds: curl -IL <archive_url>; fix the pin if it 404s","Fix environment egress: proxy env vars (HTTPS_PROXY), CA bundle (REQUESTS_CA_BUNDLE / SSL_CERT_FILE) for TLS-intercepting proxies, DNS","Retry after transient 5xx/network blips — the download is idempotent into a fresh temp workspace"],"exampleFix":"// before\ntry:\n    runtime = ensure_pinned_source(spec)\nexcept RuntimeError as e:\n    print(e)  # opaque message\n\n// after\ntry:\n    runtime = ensure_pinned_source(spec)\nexcept RuntimeError as e:\n    if \"Could not download\" in str(e) and e.__cause__:\n        logging.error(\"download failed: %r\", e.__cause__)\n    raise","handlingStrategy":"try-catch","validationCode":"import urllib.request\nwith urllib.request.urlopen(spec.archive_url, timeout=30) as r:\n    assert r.status == 200, f\"archive host returned {r.status}\"","typeGuard":null,"tryCatchPattern":"try:\n    runtime = ensure_pinned_source(spec)\nexcept RuntimeError as e:\n    cause = e.__cause__\n    if \"Could not download\" in str(e) and isinstance(cause, urllib.error.URLError):\n        log.error(\"transport failure: %r\", cause.reason)","preventionTips":["Ensure egress (proxy env vars, CA bundle) to the archive host is configured in CI before startup","Run a connectivity smoke test (HEAD request to archive_url) as a pre-deploy check"],"tags":["network","urllib","download","pinned-source","error-wrapping"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}