{"record":{"id":"3ff997a59f0b5918","repo":"github/copilot-sdk","slug":"failed-to-download-checksums-from-url-exc-if","errorCode":null,"errorMessage":"Failed to download checksums from {url}: {exc}\n\nIf you are in an offline or firewalled environment, set COPILOT_CLI_PATH to point to a manually-installed binary.","messagePattern":"Failed to download checksums from (.+?): (.+?)\n\nIf you are in an offline or firewalled environment, set COPILOT_CLI_PATH to point to a manually-installed binary\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/copilot/_cli_download.py","lineNumber":139,"sourceCode":"    return None\n\n\ndef _should_skip_download() -> bool:\n    \"\"\"Check if auto-download is disabled via environment variable.\"\"\"\n    val = os.environ.get(\"COPILOT_SKIP_CLI_DOWNLOAD\", \"\").lower()\n    return val in (\"1\", \"true\", \"yes\")\n\n\ndef _fetch_checksums(version: str) -> dict[str, str]:\n    \"\"\"Fetch and parse the SHA256SUMS.txt file.\n\n    Returns a dict mapping filename → sha256 hex digest.\n    \"\"\"\n    url = get_checksums_url(version)\n    try:\n        text = _fetch_url_bytes(url, timeout=30).decode(\"utf-8\")\n    except (RuntimeError, UnicodeDecodeError) as exc:\n        raise RuntimeError(\n            f\"Failed to download checksums from {url}: {exc}\\n\\n\"\n            \"If you are in an offline or firewalled environment, set \"\n            \"COPILOT_CLI_PATH to point to a manually-installed binary.\"\n        ) from exc\n\n    checksums: dict[str, str] = {}\n    for line in text.strip().splitlines():\n        parts = line.split()\n        if len(parts) == 2 and re.fullmatch(r\"[a-fA-F0-9]{64}\", parts[0]):\n            digest, filename = parts\n            # Some formats use *filename (binary mode indicator)\n            checksums[filename.lstrip(\"*\")] = digest.lower()\n    return checksums\n\n\ndef _verify_checksum(data: bytes, expected_hash: str, filename: str) -> None:\n    \"\"\"Verify SHA-256 checksum of downloaded data.\"\"\"\n    actual = hashlib.sha256(data).hexdigest()","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/python/copilot/_cli_download.py#L121-L157","documentation":"_fetch_checksums downloads the SHA256SUMS file for a release and converts it to text. If the HTTP fetch fails (RuntimeError from _fetch_url_bytes, e.g. network error or non-200) or the body is not valid UTF-8, it raises this RuntimeError with remediation advice pointing to COPILOT_CLI_PATH for offline use.","triggerScenarios":"Calling _fetch_verified_release_package (e.g. during CLI auto-download) while offline, behind a firewall/proxy that blocks the checksums URL, when the version has no published checksums file (404), or when the server returns a binary/encoded body.","commonSituations":"Air-gapped CI runners; corporate proxies; pinned version that was yanked; DNS failures in containers.","solutions":["Restore network access or configure proxy environment variables (HTTPS_PROXY).","Set COPILOT_CLI_PATH to a manually installed copilot binary to skip download entirely.","Verify the requested version exists and has a checksums file published.","Retry in case of transient network failure."],"exampleFix":"# before\npython -c \"from copilot._cli_download import _fetch_verified_release_package; _fetch_verified_release_package('v1.2.3', 'linux')\"\n# after\nexport COPILOT_CLI_PATH=/usr/local/bin/copilot  # skip download entirely","handlingStrategy":"fallback","validationCode":"import socket\ntry:\n    socket.create_connection((\"github.com\", 443), timeout=5)\nexcept OSError:\n    raise SystemExit(\"network unavailable — set COPILOT_CLI_PATH instead\")","typeGuard":null,"tryCatchPattern":"try:\n    package = _fetch_verified_release_package(version, platform)\nexcept RuntimeError as exc:\n    if \"Failed to download checksums\" in str(exc):\n        binary = os.environ.get(\"COPILOT_CLI_PATH\") or fail(exc)","preventionTips":["Set COPILOT_CLI_PATH in offline/firewalled environments","Configure HTTPS_PROXY for corporate networks","Pre-download and cache binaries in CI images","Verify the pinned version exists before deploying"],"tags":["network","download","python","checksums"],"backgroundTag":"http-request-failed","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}