{"record":{"id":"ad669762a64952a9","repo":"SeleniumHQ/selenium","slug":"fetch-failed-http-response-status-url","errorCode":null,"errorMessage":"Fetch failed (HTTP {response.status}): {url}","messagePattern":"Fetch failed \\(HTTP (.+?)\\): (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/update_cdp.py","lineNumber":48,"sourceCode":"        \"https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json\",\n    )\n    milestone = json.loads(r.data)[\"channels\"][channel][\"version\"].split(\".\")[0]\n    r = http.request(\n        \"GET\",\n        \"https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json\",\n    )\n    versions = json.loads(r.data)[\"versions\"]\n\n    return sorted(\n        filter(lambda v: v[\"version\"].split(\".\")[0] == str(milestone), versions),\n        key=lambda v: parse(v[\"version\"]),\n    )[-1]\n\n\ndef fetch_and_save(url, file_path):\n    response = http.request(\"GET\", url)\n    if response.status != 200:\n        raise ValueError(f\"Fetch failed (HTTP {response.status}): {url}\")\n    with open(file_path, \"wb\") as file:\n        file.write(response.data)\n\n\ndef new_chrome(chrome_milestone):\n    return chrome_milestone[\"version\"].split(\".\")[0]\n\n\ndef previous_chrome(chrome_milestone):\n    return str(int(new_chrome(chrome_milestone)) - 1)\n\n\ndef old_chrome(chrome_milestone):\n    return str(int(new_chrome(chrome_milestone)) - 3)\n\n\ndef flatten_browser_pdl(file_path, chrome_version):\n    \"\"\"Preserves the version block and concatenates all included domain .pdl files.\"\"\"","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/scripts/update_cdp.py#L30-L66","documentation":"Raised by fetch_and_save() in scripts/update_cdp.py when an HTTP GET to a URL returns non-200. This function downloads Chrome DevTools Protocol (CDP) .pdl files and saves them to disk. It is called from add_pdls() to download browser_protocol.pdl and js_protocol.pdl from the chromium/chromium and v8/v8 repositories on GitHub.","triggerScenarios":"Running update_cdp.py when a CDP .pdl file URL returns non-200: the file was moved/renamed in the Chromium repo (404), the Chrome version tag does not exist, GitHub raw content is temporarily unavailable, or network issues. The URLs point to raw.githubusercontent.com/chromium/chromium/{version}/...","commonSituations":"Chromium repo reorganization moving .pdl files; the Chrome version string in the JSON does not correspond to a valid git tag; transient GitHub CDN failure; network proxy blocking raw.githubusercontent.com; the v8_revision in DEPS points to a commit where js_protocol.pdl was at a different path.","solutions":["Retry the script — raw.githubusercontent.com failures are often transient.","Verify the specific URL from the error message is accessible (curl -I).","Check if the Chromium devtools protocol directory structure changed and update the URL pattern in update_cdp.py if so.","Manually verify the Chrome version tag exists in the chromium/chromium repo."],"exampleFix":"null","handlingStrategy":"retry","validationCode":"import urllib3\nhttp = urllib3.PoolManager()\nr = http.request('HEAD', url)\nif r.status != 200:\n    print(f'CDP file not available at {url}, deferring update_cdp')","typeGuard":"null","tryCatchPattern":"try:\n    fetch_and_save(url, file_path)\nexcept ValueError as e:\n    print(f'Failed to fetch CDP file: {e}')\n    # retry or report","preventionTips":["Verify the Chrome version tag exists in the chromium/chromium repo before running update_cdp.py.","Retry on transient raw.githubusercontent.com failures.","Check if the .pdl file paths changed in the Chromium repo."],"tags":["selenium","build-script","update-cdp","chromium","network","http","ci"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}