{"record":{"id":"f00cc047646d5c7e","repo":"Hmbown/CodeWhale","slug":"reading-remote-bundle-failed","errorCode":null,"errorMessage":"reading remote bundle failed","messagePattern":"reading remote bundle failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/config_bundles.rs","lineNumber":807,"sourceCode":"        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\nfn validate_bundle_url(url: &reqwest::Url) -> Result<()> {\n    if !matches!(url.scheme(), \"http\" | \"https\") {\n        bail!(\"unsupported bundle URL scheme; use https\");\n    }\n    if !url.username().is_empty() || url.password().is_some() {\n        bail!(\"bundle URLs may not include credentials\");\n    }\n    let host = url.host_str().context(\"bundle URL must include a host\")?;\n    match url.scheme() {\n        \"https\" => Ok(()),\n        \"http\" if is_loopback_bundle_host(host) => Ok(()),\n        \"http\" => bail!(\"plain http is only allowed for loopback hosts; use https\"),","sourceCodeStart":789,"sourceCodeEnd":825,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/config_bundles.rs#L789-L825","documentation":"Reading the bundle response body via read_to_end on the size-bounded stream failed with an I/O error. The reader is capped at MAX_BUNDLE_BYTES + 1 so oversize bodies are reported separately; this message specifically means the read itself errored (connection dropped mid-body, timeout) rather than the body being too large.","triggerScenarios":"The response body stream errors during body.take(MAX_BUNDLE_BYTES + 1).read_to_end() — server closed the connection prematurely, network interruption, or body read timeout.","commonSituations":"Flaky network or proxy dropping large downloads, server crashing while streaming the bundle, aggressive idle timeouts on long transfers.","solutions":["Retry the import; transient connection drops are the usual cause.","Verify the server serves the full bundle (compare content-length / download with curl).","Check for proxies or load balancers with short body timeouts.","Reduce bundle size if the server has trouble streaming it."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"let head = client.head(bundle_url).send()?; let len: u64 = head.headers().get(header::CONTENT_LENGTH).and_then(|v| v.to_str().ok()?.parse().ok()).unwrap_or(0); if len > MAX { bail!(\"bundle too large before download\"); }","typeGuard":null,"tryCatchPattern":"for attempt in 0..3 { match fetch_bundle(url) { Err(e) if e.to_string().contains(\"reading remote bundle failed\") => sleep_backoff(attempt), other => return other, } }","preventionTips":["Retry transient body-read failures with backoff.","Check server/proxy idle timeouts for large bodies.","Keep bundles small enough to download reliably.","Monitor flaky links between importer and mirror."],"tags":["network","io","download"],"backgroundTag":"network-request-failed","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}