gitbutlerapp/gitbutler · error
Download of failed with HTTP status
Error message
Download of {url} failed with HTTP status: {response_code} What it means
`download_to_string` uses curl (curl::easy) to fetch a URL and requires an HTTP 200 response. Any other status (3xx terminal redirects that curl did not follow, 4xx/5xx) makes it bail with the URL and status code so the caller knows the content fetch failed.
Solutions
- Check the URL and requested version — confirm the artifact/metadata actually exists (HTTP status 404 usually means the version was never published).
- Retry the download after a delay; 5xx codes are often transient.
- Check network/proxy configuration if statuses like 403/502 appear unexpectedly.
- Inspect the response body outside this helper if you need the server's error detail — this bail only surfaces the code.
Example fix
// before
let manifest = download_to_string(&manifest_url)?;
// after
let manifest = match download_to_string(&manifest_url) {
Ok(m) => m,
Err(e) if e.to_string().contains("HTTP status: 5") => {
std::thread::sleep(Duration::from_secs(3));
download_to_string(&manifest_url)?
}
Err(e) => return Err(e),
}; Defensive patterns
Strategy: retry
Validate before calling
let resp = reqwest::blocking::get(url)?;
if !resp.status().is_success() {
anyhow::bail!("pre-check failed for {url}: {}", resp.status());
} Try / catch
match download_to_string(&url) {
Ok(s) => s,
Err(e) if e.to_string().contains("HTTP status: 5") => retry_with_backoff(3, || download_to_string(&url))?,
Err(e) => return Err(anyhow!("download failed, check URL/version: {e:#}")),
} Prevention
- Pre-flight the URL with a lightweight HEAD/GET before downloading the full payload.
- Retry on transient 5xx with exponential backoff; fail fast on 4xx.
- Validate the requested version string against a published versions list before building the URL.
- Log the URL alongside the error so typos are obvious.
When it happens
Trigger: Calling download_and_install_app / download_to_string with a URL that returns non-200: a manifest or metadata URL that 404s because the version does not exist, a 503 from a CDN outage, or a 401 on a resource requiring auth.
Common situations: Requesting metadata for an unpublished but version; transient CDN/server errors; firewalls or proxies returning an HTML error page; URL typos producing 404s.
Related errors
- Download failed with HTTP status
- Anthropic API error ( )
- Bitbucket request failed
- Bitbucket request failed
- Download failed, the download artifact could not be found…
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/e2d67836e062eca2.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-installer/src/download.rs:37
{
let mut transfer = easy.transfer();
transfer
.write_function(|data| {
buf.borrow_mut().extend_from_slice(data);
Ok(data.len())
})
.context("Failed to set write function")?;
transfer
.perform()
.with_context(|| format!("Failed to download from {url}"))?;
}
let response_code = easy
.response_code()
.context("Failed to get response code")?;
if response_code != 200 {
bail!("Download of {url} failed with HTTP status: {response_code}");
}
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}"))?;
String::from_utf8(buf.into_inner()).context("Signature file is not valid UTF-8")
}
pub(crate) fn download_file(url: &str, dest: &Path) -> Result<()> {
let mut easy = create_client()?;
easy.url(url)
.with_context(|| format!("Failed to set URL: {url}"))?;View on GitHub (pinned to 58e5313667)