{"record":{"id":"3c2eaca92d6e899b","repo":"SeleniumHQ/selenium","slug":"failed-to-download-url-http-r-status","errorCode":null,"errorMessage":"Failed to download {url}: HTTP {r.status}","messagePattern":"Failed to download (.+?): HTTP (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"scripts/update_cddl.py","lineNumber":106,"sourceCode":"        raise RuntimeError(f\"Failed to list {CDDL_PATH} at {commit}: HTTP {r.status}\")\n    entries = json.loads(r.data)\n    # Only the \"-all\" union of each protocol is consumed; the local/remote splits\n    # feed nothing (BiDi generation merges the union), so they are not pinned.\n    return sorted(e[\"name\"] for e in entries if e[\"type\"] == \"file\" and e[\"name\"].endswith(\"-all.cddl\"))\n\n\ndef repo_name(filename):\n    \"\"\"Derive the Bazel repo name from a CDDL filename.\n\n    ``at-driver-all.cddl`` -> ``at_driver_all_cddl``\n    \"\"\"\n    return filename[: -len(\".cddl\")].replace(\"-\", \"_\") + \"_cddl\"\n\n\ndef sha256_of_url(url):\n    r = http.request(\"GET\", url)\n    if r.status != 200:\n        raise RuntimeError(f\"Failed to download {url}: HTTP {r.status}\")\n    return hashlib.sha256(r.data).hexdigest()\n\n\ndef sha256_of(commit, filename):\n    return sha256_of_url(f\"https://raw.githubusercontent.com/{REPO}/{commit}/{CDDL_PATH}/{filename}\")\n\n\ndef build_entries(commit, filenames):\n    return [(repo_name(name), name, sha256_of(commit, name)) for name in filenames]\n\n\ndef build_dfns_entries(commit):\n    \"\"\"(repo, dfns_filename, sha256) for each merged spec, hashed at the webref commit.\"\"\"\n    return [\n        (name, filename, sha256_of_url(f\"https://raw.githubusercontent.com/{REPO}/{commit}/{DFNS_PATH}/{filename}\"))\n        for name, filename in MERGED_DFNS\n    ]\n","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/scripts/update_cddl.py#L88-L124","documentation":"Raised by sha256_of_url() in scripts/update_cddl.py when a raw.githubusercontent.com GET request returns non-200. This function downloads the raw content of a CDDL or dfns file to compute its sha256 hash for Bazel pinning. Called from sha256_of() for CDDL files and build_dfns_entries() for dfns JSON indexes, and from resolve_bidi_spec() for the webdriver-bidi spec HTML.","triggerScenarios":"Running update_cddl.py when a specific raw file URL returns non-200: the file was renamed or removed at the pinned commit (404), the commit SHA is invalid, GitHub raw content CDN is temporarily unavailable (5xx), or rate limiting. Each individual file is fetched separately, so one bad URL fails the whole run.","commonSituations":"Upstream file renamed/removed between the directory listing and individual file downloads; transient GitHub CDN failure; network interruption mid-run; the commit was force-pushed and files changed; rate limiting on raw.githubusercontent.com.","solutions":["Retry the script — raw.githubusercontent.com failures are often transient.","Verify the specific URL from the error message is accessible in a browser or with curl.","If a file was renamed upstream, the list_cddl_files() call should have picked up the new name — check for a race between listing and downloading.","Pin to a specific --commit known to have all files intact."],"exampleFix":"null","handlingStrategy":"retry","validationCode":"import urllib3\nhttp = urllib3.PoolManager()\nr = http.request('HEAD', url)\nif r.status != 200:\n    print(f'File not available at {url}, deferring')","typeGuard":"null","tryCatchPattern":"try:\n    sha = sha256_of_url(url)\nexcept RuntimeError as e:\n    print(f'Failed to download {url}: {e}')\n    # retry or skip","preventionTips":["Set GITHUB_TOKEN to avoid rate limits on raw.githubusercontent.com.","Retry on transient CDN failures.","Pin to a known-good commit with all files intact."],"tags":["selenium","build-script","update-cddl","github","network","http","ci"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}