{"record":{"id":"f0779c25262e8e03","repo":"Hmbown/CodeWhale","slug":"bundle-fetch-failed-with-http-status","errorCode":null,"errorMessage":"bundle fetch failed with HTTP status {}","messagePattern":"bundle fetch failed with HTTP status (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/config_bundles.rs","lineNumber":795,"sourceCode":"        if redirects >= MAX_REDIRECTS {\n            bail!(\"bundle fetch exceeded the five-redirect limit\");\n        }\n        let location = response\n            .headers()\n            .get(reqwest::header::LOCATION)\n            .ok_or_else(|| anyhow!(\"bundle redirect is missing a valid Location header\"))?\n            .to_str()\n            .map_err(|_| anyhow!(\"bundle redirect is missing a valid Location header\"))?;\n        let next_url = current_url\n            .join(location)\n            .map_err(|_| anyhow!(\"bundle redirect Location is invalid\"))?;\n        validate_bundle_redirect(&initial_scheme, &next_url)?;\n        current_url = next_url;\n        redirects += 1;\n    };\n\n    if !response.status().is_success() {\n        bail!(\n            \"bundle fetch failed with HTTP status {}\",\n            response.status().as_u16()\n        );\n    }\n\n    // Read at most MAX_BUNDLE_BYTES + 1 so an oversize body is detected\n    // rather than silently truncated.\n    let mut buffer = Vec::new();\n    let body = response;\n    body.take(MAX_BUNDLE_BYTES + 1)\n        .read_to_end(&mut buffer)\n        .map_err(|_| anyhow!(\"reading remote bundle failed\"))?;\n    if buffer.len() as u64 > MAX_BUNDLE_BYTES {\n        bail!(\"remote bundle exceeds the {MAX_BUNDLE_BYTES} byte limit; refused\");\n    }\n    Ok(buffer)\n}\n","sourceCodeStart":777,"sourceCodeEnd":813,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/config_bundles.rs#L777-L813","documentation":"After following any permitted redirects, the bundle fetch completed with a non-success HTTP status. `fetch_bundle` bails with the numeric status so the caller knows the remote refused or could not serve the bundle rather than the request itself failing.","triggerScenarios":"`codewhale config bundle import <url>` where the final response status is not 2xx — 404 (URL removed), 403 (auth required), 500 (server error), etc.","commonSituations":"Stale or mistyped bundle URL; a private bundle endpoint requiring credentials (which this CLI refuses to send via URL); a CDN or server outage.","solutions":["Check the URL is correct and the bundle still exists at that location (visit it in a browser or curl -I).","Retry if the server returned 5xx, the outage may be transient.","Download the bundle through an authenticated client manually and import from the local file."],"exampleFix":"// before\ncodewhale config bundle import https://example.com/bundles/old.zip   # 404\n// after\ncodewhale config bundle import https://example.com/bundles/current.zip","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// retry only on transient 5xx, surface permanent 4xx\nmatch fetch_bundle(url) {\n    Err(e) if e.to_string().contains(\"HTTP status 5\") && attempt < 3 => backoff_and_retry(),\n    Err(e) => return Err(anyhow!(\"bundle download failed: {e:#}\")),\n    Ok(bytes) => Ok(bytes),\n}","preventionTips":["Verify bundle URLs return 200 before distributing them (curl -I).","Prefer importing from a checked-in file over a volatile URL.","Monitor mirror/CDN health if bundles are fetched in automation."],"tags":["http","bundle-fetch","network"],"backgroundTag":"http-error-response","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T21:17:16.096Z"}