SeleniumHQ/selenium · error · RuntimeError
Failed to resolve {repo}@{branch}: HTTP {r.status}
Error message
Failed to resolve {repo}@{branch}: HTTP {r.status} What it means
Raised by resolve_commit_for() in scripts/update_cddl.py when the GitHub Commits API call to resolve a branch tip returns non-200. The function calls api.github.com/repos/{repo}/commits/{branch} and extracts the 'sha' from the response. Used to resolve both w3c/webref branches and w3c/webdriver-bidi branches.
Source
Thrown at scripts/update_cddl.py:136
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
]
def resolve_bidi_spec(branch):
"""Resolve the w3c/webdriver-bidi gh-pages tip and hash its rendered index.html."""
commit = resolve_commit_for(BIDI_SPEC_REPO, branch)
url = f"https://raw.githubusercontent.com/{BIDI_SPEC_REPO}/{commit}/{BIDI_SPEC_FILE}"
return commit, sha256_of_url(url)
def resolve_commit_for(repo, branch):
r = http.request("GET", f"https://api.github.com/repos/{repo}/commits/{branch}", headers=API_HEADERS)
if r.status != 200:
raise RuntimeError(f"Failed to resolve {repo}@{branch}: HTTP {r.status}")
return json.loads(r.data)["sha"]
def existing_repo_names(content):
return set(re.findall(r'\(\s*"([a-z0-9_]+)"\s*,\s*"[^"]+\.cddl"', content))
def render_files(var, entries):
lines = [f"{var} = ["]
for name, filename, sha256 in entries:
lines.append(f' ("{name}", "{filename}", "{sha256}"),')
lines.append("]")
return "\n".join(lines)
def sub_once(content, pattern, replacement, where):
content, n = re.subn(pattern, replacement, content, flags=re.S)
if n != 1:View on GitHub (pinned to aa36b38e69)
Solutions
- Set GITHUB_TOKEN to increase the API rate limit.
- Verify the repo and branch still exist by checking GitHub in a browser.
- If the branch was renamed, update the default branch or pass --branch with the correct name.
- Retry after rate limit reset.
Example fix
null
Defensive patterns
Strategy: retry
Validate before calling
import os, urllib3, json
http = urllib3.PoolManager()
headers = {'Authorization': f'Bearer {os.environ.get("GITHUB_TOKEN", "")}', 'Accept': 'application/vnd.github+json', 'User-Agent': 'check'}
r = http.request('GET', f'https://api.github.com/repos/{repo}/branches/{branch}', headers=headers)
if r.status != 200:
print(f'Branch {branch} not found in {repo}') Type guard
null
Try / catch
try:
commit = resolve_commit_for(repo, branch)
except RuntimeError as e:
print(f'Failed to resolve {repo}@{branch}: {e}') Prevention
- Set GITHUB_TOKEN for higher API rate limits.
- Verify the repo and branch exist before running the script.
- Use --commit flag to skip the branch resolution API call entirely if you know the SHA.
- Retry after rate limit reset.
When it happens
Trigger: Running update_cddl.py when the GitHub API cannot resolve the repo/branch: repo renamed or deleted (404/moved), branch renamed or deleted (404), rate limited (403), GitHub outage (5xx). The repo variable can be 'w3c/webref' or 'w3c/webdriver-bidi' depending on the caller.
Common situations: GitHub API rate limiting (especially unauthenticated CI runs); the upstream branch was renamed (e.g., 'main' to 'master' or vice versa); the repository was archived or moved; network proxy blocking the GitHub API; CI without GITHUB_TOKEN.
Related errors
- Failed to list {CDDL_PATH} at {commit}: HTTP {r.status}
- Failed to download {url}: HTTP {r.status}
- Download unavailable (HTTP {r.status}): {url}
- Expected exactly one {where} in {BZL_FILE.name}, found {n}
- Expected exactly one webref_cddl_extension use_repo block, f
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/14ffc6f4493ad2a0.
Report an issue: GitHub.