Hmbown/CodeWhale · error

bundle fetch request failed

Error message

bundle fetch request failed

What it means

fetch_bundle issues a GET to the bundle URL through reqwest and deliberately discards the underlying error, because reqwest transport error Display strings can embed the full URL including query strings or userinfo credentials. This message means the HTTP request itself failed at the transport layer (DNS, connect, TLS, timeout) before any response was received. The URL-free message is a security choice to avoid leaking secrets.

Solutions

  1. Verify the bundle URL is correct and the server is reachable (curl the URL from the same machine).
  2. Check network connectivity / DNS and proxy settings.
  3. If TLS is the issue, ensure the server presents a certificate trusted by the system store.
  4. Run the command with network access enabled; sandboxed/no-network environments always produce this error.

Example fix

// before
let url = "htp://wrong-scheme/bundle.toml";
codewhale bundle import --url url
// after
let url = "https://reachable-host/bundle.toml";
codewhale bundle import --url url
Defensive patterns

Strategy: retry

Validate before calling

if let Ok(h) = reqwest::Client::new().get(bundle_url).send().await { println!("reachable: {}", h.status()); }

Try / catch

match fetch_bundle(url) { Err(e) if e.to_string().contains("bundle fetch request failed") => { eprintln!("host unreachable; check URL/network"); retry_with_backoff(3); } Ok(b) => apply(b), Err(e) => return Err(e), }

Prevention

When it happens

Trigger: client.get(url).send() returns Err — unreachable host, DNS failure, connection refused/reset, TLS handshake failure, or request timeout during bundle import over http(s).

Common situations: Importing a bundle from a typoed or down host, offline or air-gapped environments (tests explicitly cover no-network-access), firewall blocking the port, invalid or self-signed TLS certificates.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/7eca679a0c842dff. Report an issue: GitHub.

Appendix: source

Thrown at crates/cli/src/config_bundles.rs:772

    let mut current_url = reqwest::Url::parse(url).map_err(|_| anyhow!("invalid bundle URL"))?;
    validate_bundle_url(&current_url)?;
    let initial_scheme = current_url.scheme().to_string();

    let client = codewhale_release::platform_blocking_http_client_builder()
        .timeout(std::time::Duration::from_secs(FETCH_TIMEOUT_SECS))
        // Redirect targets must pass the same scheme/host policy as the
        // initial request, so redirects are followed explicitly below.
        .redirect(reqwest::redirect::Policy::none())
        .build()
        .map_err(|_| anyhow!("building bundle fetch client failed"))?;
    let mut redirects = 0usize;
    let response = loop {
        let response = client
            .get(current_url.clone())
            .send()
            // reqwest errors can include the full URL (including its query or
            // userinfo), so keep transport failures deliberately URL-free.
            .map_err(|_| anyhow!("bundle fetch request failed"))?;

        if !response.status().is_redirection() {
            break response;
        }
        if redirects >= MAX_REDIRECTS {
            bail!("bundle fetch exceeded the five-redirect limit");
        }
        let location = response
            .headers()
            .get(reqwest::header::LOCATION)
            .ok_or_else(|| anyhow!("bundle redirect is missing a valid Location header"))?
            .to_str()
            .map_err(|_| anyhow!("bundle redirect is missing a valid Location header"))?;
        let next_url = current_url
            .join(location)
            .map_err(|_| anyhow!("bundle redirect Location is invalid"))?;
        validate_bundle_redirect(&initial_scheme, &next_url)?;
        current_url = next_url;

View on GitHub (pinned to 73e0f67d83)