{"record":{"id":"14ffc6f4493ad2a0","repo":"SeleniumHQ/selenium","slug":"failed-to-resolve-repo-branch-http-r-status","errorCode":null,"errorMessage":"Failed to resolve {repo}@{branch}: HTTP {r.status}","messagePattern":"Failed to resolve (.+?)@(.+?): HTTP (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"scripts/update_cddl.py","lineNumber":136,"sourceCode":"def 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\n\ndef resolve_bidi_spec(branch):\n    \"\"\"Resolve the w3c/webdriver-bidi gh-pages tip and hash its rendered index.html.\"\"\"\n    commit = resolve_commit_for(BIDI_SPEC_REPO, branch)\n    url = f\"https://raw.githubusercontent.com/{BIDI_SPEC_REPO}/{commit}/{BIDI_SPEC_FILE}\"\n    return commit, sha256_of_url(url)\n\n\ndef resolve_commit_for(repo, branch):\n    r = http.request(\"GET\", f\"https://api.github.com/repos/{repo}/commits/{branch}\", headers=API_HEADERS)\n    if r.status != 200:\n        raise RuntimeError(f\"Failed to resolve {repo}@{branch}: HTTP {r.status}\")\n    return json.loads(r.data)[\"sha\"]\n\n\ndef existing_repo_names(content):\n    return set(re.findall(r'\\(\\s*\"([a-z0-9_]+)\"\\s*,\\s*\"[^\"]+\\.cddl\"', content))\n\n\ndef render_files(var, entries):\n    lines = [f\"{var} = [\"]\n    for name, filename, sha256 in entries:\n        lines.append(f'    (\"{name}\", \"{filename}\", \"{sha256}\"),')\n    lines.append(\"]\")\n    return \"\\n\".join(lines)\n\n\ndef sub_once(content, pattern, replacement, where):\n    content, n = re.subn(pattern, replacement, content, flags=re.S)\n    if n != 1:","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/scripts/update_cddl.py#L118-L154","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"null","handlingStrategy":"retry","validationCode":"import os, urllib3, json\nhttp = urllib3.PoolManager()\nheaders = {'Authorization': f'Bearer {os.environ.get(\"GITHUB_TOKEN\", \"\")}', 'Accept': 'application/vnd.github+json', 'User-Agent': 'check'}\nr = http.request('GET', f'https://api.github.com/repos/{repo}/branches/{branch}', headers=headers)\nif r.status != 200:\n    print(f'Branch {branch} not found in {repo}')","typeGuard":"null","tryCatchPattern":"try:\n    commit = resolve_commit_for(repo, branch)\nexcept RuntimeError as e:\n    print(f'Failed to resolve {repo}@{branch}: {e}')","preventionTips":["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."],"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"}