{"record":{"id":"167530fd4e305058","repo":"SeleniumHQ/selenium","slug":"failed-to-list-cddl-path-at-commit-http-r-st","errorCode":null,"errorMessage":"Failed to list {CDDL_PATH} at {commit}: HTTP {r.status}","messagePattern":"Failed to list (.+?) at (.+?): HTTP (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"scripts/update_cddl.py","lineNumber":88,"sourceCode":"BIDI_SPEC_FILE = \"index.html\"\nBIDI_SPEC_REPO_NAME = \"webdriver_bidi_spec_html\"\n\nBZL_FILE = root_dir / \"common\" / \"webref_cddl.bzl\"\nMODULE_FILE = root_dir / \"MODULE.bazel\"\n\n\ndef resolve_commit(branch):\n    return resolve_commit_for(REPO, branch)\n\n\ndef list_cddl_files(commit):\n    r = http.request(\n        \"GET\",\n        f\"https://api.github.com/repos/{REPO}/contents/{CDDL_PATH}?ref={commit}\",\n        headers=API_HEADERS,\n    )\n    if r.status != 200:\n        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}\")","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/scripts/update_cddl.py#L70-L106","documentation":"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.","triggerScenarios":"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}.","commonSituations":"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.","solutions":["Set GITHUB_TOKEN environment variable to increase the API rate limit from 60 to 5000 requests/hour.","Retry after the rate limit window resets (check X-RateLimit-Reset header).","Verify the w3c/webref repo still has the ed/cddl path at the target commit by checking GitHub in a browser.","If the path moved, update CDDL_PATH in update_cddl.py."],"exampleFix":"null","handlingStrategy":"retry","validationCode":"import os, urllib3, json\nhttp = urllib3.PoolManager()\nheaders = {'Accept': 'application/vnd.github+json', 'User-Agent': 'check', 'Authorization': f'Bearer {os.environ.get(\"GITHUB_TOKEN\", \"\")}'}\nr = http.request('GET', 'https://api.github.com/rate_limit', headers=headers)\nremaining = json.loads(r.data)['resources']['core']['remaining']\nif remaining < 5:\n    print('GitHub API rate limit nearly exhausted; deferring update_cddl')","typeGuard":"null","tryCatchPattern":"try:\n    filenames = list_cddl_files(commit)\nexcept RuntimeError as e:\n    print(f'GitHub API error listing CDDL files: {e}')\n    # retry after rate limit reset, or use cached pin","preventionTips":["Set GITHUB_TOKEN environment variable in CI to increase rate limit from 60 to 5000 requests/hour.","Check rate limit status before running the script.","Retry on transient GitHub API failures (5xx, rate limit).","Pin to a specific --commit to avoid repeated API calls."],"tags":["selenium","build-script","update-cddl","github-api","network","rate-limit","ci"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}