gitbutlerapp/gitbutler · error

Download failed with HTTP status

Error message

Download failed with HTTP status: {response_code}

What it means

Generic failure branch of `download_file`: the artifact download endpoint returned a non-200, non-403 status. Unlike the 403 case, this does not imply the artifact is missing — it signals a server/network problem and bails with the raw status code.

Solutions

  1. Read the status code in the message: retry on 5xx/429 after a backoff; fix proxy/auth config on 401/407.
  2. Check the GitButler release server status / your network connectivity.
  3. Retry the install command; transient server errors usually clear on their own.
  4. If persistent, download the artifact manually with curl to inspect the actual response body.

Example fix

// before
download_and_install_app(&config)?;
// after
for attempt in 0..3 {
    match download_and_install_app(&config) {
        Ok(()) => break,
        Err(e) if e.to_string().contains("HTTP status: 5") && attempt < 2 => {
            std::thread::sleep(Duration::from_secs(2u64.pow(attempt)));
        }
        Err(e) => return Err(e),
    }
}
Defensive patterns

Strategy: retry

Validate before calling

// probe endpoint health before the real download
let probe = reqwest::blocking::get(&url)?;
if probe.status().is_server_error() {
    anyhow::bail!("artifact server unhealthy ({})", probe.status());
}

Try / catch

match download_and_install_app(&config) {
    Err(e) if e.to_string().contains("HTTP status: 429") => { wait_rate_limit(); retry()? }
    Err(e) if e.to_string().contains("HTTP status: 5") => retry_with_backoff(3)?,
    Err(e) => return Err(e),
    Ok(()) => Ok(()),
}

Prevention

When it happens

Trigger: The release CDN returns 500/502/503 during an outage; a proxy returns 401/407; rate limiting returns 429; any intermediary error page replaces the binary download.

Common situations: Downloading during a CDN or GitHub releases outage; corporate MITM proxies intercepting the request; too many downloads triggering throttling.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/4d80872b165d926a. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-installer/src/download.rs:129

            return Err(io_err).context("Failed to write downloaded data");
        }

        // If perform failed for other reasons, propagate that error
        perform_result.with_context(|| format!("Failed to download from {url}"))?;
    }

    // Clear progress line
    crate::ui::println_empty();

    let response_code = easy
        .response_code()
        .context("Failed to get response code")?;
    if response_code == 403 {
        bail!(
            "Download failed, the download artifact could not be found. Most likely, the but CLI has not been published for the requested version."
        )
    } else if response_code != 200 {
        bail!("Download failed with HTTP status: {response_code}");
    }

    // Validate the effective URL after following redirects
    // This protects against malicious redirects to untrusted domains or insecure protocols
    let effective_url = easy
        .effective_url()
        .context("Failed to get effective URL")?
        .ok_or_else(|| anyhow!("Effective URL is missing"))?;

    crate::release::validate_download_url(effective_url)
        .with_context(|| format!("Download was redirected to an untrusted URL: {effective_url}"))?;

    Ok(())
}

View on GitHub (pinned to 58e5313667)