SeleniumHQ/selenium · error · RuntimeError

Failed to list {CDDL_PATH} at {commit}: HTTP {r.status}

Error message

Failed to list {CDDL_PATH} at {commit}: HTTP {r.status}

What it means

Raised by list_cddl_files() in scripts/update_cddl.py when the GitHub Contents API call to list files in w3c/webref's ed/cddl directory returns a non-200 status. The API call includes headers for Accept and User-Agent. This is a build script that pins CDDL (Concise Data Definition Language) grammar files from the w3c/webref repository for WebDriver BiDi protocol generation.

Source

Thrown at scripts/update_cddl.py:88

BIDI_SPEC_FILE = "index.html"
BIDI_SPEC_REPO_NAME = "webdriver_bidi_spec_html"

BZL_FILE = root_dir / "common" / "webref_cddl.bzl"
MODULE_FILE = root_dir / "MODULE.bazel"


def resolve_commit(branch):
    return resolve_commit_for(REPO, branch)


def list_cddl_files(commit):
    r = http.request(
        "GET",
        f"https://api.github.com/repos/{REPO}/contents/{CDDL_PATH}?ref={commit}",
        headers=API_HEADERS,
    )
    if r.status != 200:
        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}")

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Set GITHUB_TOKEN environment variable to increase the API rate limit from 60 to 5000 requests/hour.
  2. Retry after the rate limit window resets (check X-RateLimit-Reset header).
  3. Verify the w3c/webref repo still has the ed/cddl path at the target commit by checking GitHub in a browser.
  4. If the path moved, update CDDL_PATH in update_cddl.py.

Example fix

null
Defensive patterns

Strategy: retry

Validate before calling

import os, urllib3, json
http = urllib3.PoolManager()
headers = {'Accept': 'application/vnd.github+json', 'User-Agent': 'check', 'Authorization': f'Bearer {os.environ.get("GITHUB_TOKEN", "")}'}
r = http.request('GET', 'https://api.github.com/rate_limit', headers=headers)
remaining = json.loads(r.data)['resources']['core']['remaining']
if remaining < 5:
    print('GitHub API rate limit nearly exhausted; deferring update_cddl')

Type guard

null

Try / catch

try:
    filenames = list_cddl_files(commit)
except RuntimeError as e:
    print(f'GitHub API error listing CDDL files: {e}')
    # retry after rate limit reset, or use cached pin

Prevention

When it happens

Trigger: Running update_cddl.py when the GitHub API is rate-limited (403 with rate limit headers), the repo/branch/path was renamed or removed (404), GitHub is experiencing an outage (5xx), or network connectivity is blocked. The function calls api.github.com/repos/w3c/webref/contents/ed/cddl?ref={commit}.

Common situations: GitHub API rate limiting (60 requests/hour unauthenticated, 5000/hour with token); CI running without GITHUB_TOKEN; the webref repo reorganized its directory structure; the pinned commit SHA is invalid or the branch was renamed; network proxy blocking api.github.com.

Related errors


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