{"record":{"id":"316a43a5a80e9b5b","repo":"SeleniumHQ/selenium","slug":"download-unavailable-http-r-status-url","errorCode":null,"errorMessage":"Download unavailable (HTTP {r.status}): {url}","messagePattern":"Download unavailable \\(HTTP (.+?)\\): (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/pinned_browsers.py","lineNumber":26,"sourceCode":"\nimport urllib3\nfrom packaging.version import parse\n\nfrom scripts.generated_note import generated_note\n\n# Find the current stable versions of each browser we\n# support and the sha256 of these. That's useful for\n# updating `//common:repositories.bzl`\n\nhttp = urllib3.PoolManager()\n\n\ndef calculate_hash(url):\n    print(f\"Calculate hash for {url}\", file=sys.stderr)\n    h = hashlib.sha256()\n    r = http.request(\"GET\", url, preload_content=False)\n    if r.status != 200:\n        raise ValueError(f\"Download unavailable (HTTP {r.status}): {url}\")\n    for b in iter(lambda: r.read(4096), b\"\"):\n        h.update(b)\n    return h.hexdigest()\n\n\ndef get_chrome_info_for_channel(channel):\n    r = http.request(\n        \"GET\",\n        \"https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json\",\n    )\n    milestone = json.loads(r.data)[\"channels\"][channel][\"version\"].split(\".\")[0]\n    r = http.request(\n        \"GET\",\n        \"https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json\",\n    )\n    versions = json.loads(r.data)[\"versions\"]\n\n    return sorted(","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/scripts/pinned_browsers.py#L8-L44","documentation":"Raised by calculate_hash() in scripts/pinned_browsers.py when the HTTP GET to a browser/driver download URL returns a non-200 status. The function streams the response body (preload_content=False) to compute sha256, so it checks status before reading. This is a CI/build script used to pin browser binaries for the Selenium Bazel build (common/repositories.bzl).","triggerScenarios":"Running the pinned_browsers.py script (via bazel run //scripts:pinned_browsers) when a download URL is temporarily or permanently unavailable: 404 (URL removed/changed), 403 (rate-limited or access denied), 500/502/503 (server error), or network connectivity issues during CI.","commonSituations":"Browser vendor (Google, Mozilla, Microsoft) temporarily takes down a download endpoint during a release transition; CDN rate limiting from too many CI runs; network proxy or firewall blocking the download; URL format changed upstream and the script has not been updated; transient network failure in CI.","solutions":["Retry the script — many failures are transient (CDN hiccups, rate limits).","Check if the URL is reachable in a browser or with curl -I to distinguish 404 (permanent) from transient errors.","If a vendor changed their URL scheme, update the pinned_browsers.py script to use the new URL pattern.","Run the script from a network without proxies/firewalls that might block browser download endpoints."],"exampleFix":"// before\n$ bazel run //scripts:pinned_browsers\nValueError: Download unavailable (HTTP 404): https://...\n// after\n# Retry (transient):\n$ bazel run //scripts:pinned_browsers\n# If persistent, verify URL:\n$ curl -I 'https://...'","handlingStrategy":"retry","validationCode":"import urllib3\nhttp = urllib3.PoolManager()\nr = http.request('HEAD', url)\nif r.status != 200:\n    print(f'URL not available (HTTP {r.status}), deferring pinned_browsers run')\n    # do not run the script","typeGuard":"null","tryCatchPattern":"try:\n    calculate_hash(url)\nexcept ValueError as e:\n    # download unavailable; retry or report\n    print(f'Skipping: {e}')","preventionTips":["Run pinned_browsers.py from CI with retry logic for transient HTTP failures.","Pre-check download URLs with HEAD requests before running the full script.","Run from a network without restrictive proxies that block browser vendor CDNs."],"tags":["selenium","build-script","pinned-browsers","network","http","ci"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}