SeleniumHQ/selenium · error · RuntimeError

Failed to download {url}: HTTP {r.status}

Error message

Failed to download {url}: HTTP {r.status}

What it means

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.

Source

Thrown at scripts/update_cddl.py:106

        raise RuntimeError(f"Failed to list {CDDL_PATH} at {commit}: HTTP {r.status}")
    entries = json.loads(r.data)
    # Only the "-all" union of each protocol is consumed; the local/remote splits
    # feed nothing (BiDi generation merges the union), so they are not pinned.
    return sorted(e["name"] for e in entries if e["type"] == "file" and e["name"].endswith("-all.cddl"))


def repo_name(filename):
    """Derive the Bazel repo name from a CDDL filename.

    ``at-driver-all.cddl`` -> ``at_driver_all_cddl``
    """
    return filename[: -len(".cddl")].replace("-", "_") + "_cddl"


def sha256_of_url(url):
    r = http.request("GET", url)
    if r.status != 200:
        raise RuntimeError(f"Failed to download {url}: HTTP {r.status}")
    return hashlib.sha256(r.data).hexdigest()


def sha256_of(commit, filename):
    return sha256_of_url(f"https://raw.githubusercontent.com/{REPO}/{commit}/{CDDL_PATH}/{filename}")


def build_entries(commit, filenames):
    return [(repo_name(name), name, sha256_of(commit, name)) for name in filenames]


def build_dfns_entries(commit):
    """(repo, dfns_filename, sha256) for each merged spec, hashed at the webref commit."""
    return [
        (name, filename, sha256_of_url(f"https://raw.githubusercontent.com/{REPO}/{commit}/{DFNS_PATH}/{filename}"))
        for name, filename in MERGED_DFNS
    ]

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Retry the script — raw.githubusercontent.com failures are often transient.
  2. Verify the specific URL from the error message is accessible in a browser or with curl.
  3. 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.
  4. Pin to a specific --commit known to have all files intact.

Example fix

null
Defensive patterns

Strategy: retry

Validate before calling

import urllib3
http = urllib3.PoolManager()
r = http.request('HEAD', url)
if r.status != 200:
    print(f'File not available at {url}, deferring')

Type guard

null

Try / catch

try:
    sha = sha256_of_url(url)
except RuntimeError as e:
    print(f'Failed to download {url}: {e}')
    # retry or skip

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/3c2eaca92d6e899b. Report an issue: GitHub.