nikivdev/code · error
download failed ({})
Error message
download failed ({}) What it means
install downloads the binary from the resolved download URL. If the HTTP response status is not successful, it bails with 'download failed (<status>)'. The `.context("failed to download binary")` only covers transport errors; this error covers server-side rejections.
Source
Thrown at src/registry.rs:241
let version = opts.version.clone();
let manifest = fetch_manifest(&client, ®istry_url, &name, version.as_deref())?;
let target = detect_target_triple()?;
let target_entry = manifest
.targets
.get(&target)
.with_context(|| format!("No binaries for target {}", target))?;
let bin = resolve_install_bin(&name, &opts.bin, &manifest, target_entry)?;
let path = target_entry
.binaries
.get(&bin)
.with_context(|| format!("No binary '{}' in manifest", bin))?;
let download_url = resolve_download_url(®istry_url, path);
let response = client
.get(download_url)
.send()
.context("failed to download binary")?;
if !response.status().is_success() {
bail!("download failed ({})", response.status());
}
let bytes = response.bytes().context("failed to read download")?;
if !opts.no_verify {
if let Some(expected) = target_entry.sha256.get(&bin) {
let actual = sha256_bytes(&bytes);
if expected != &actual {
bail!("checksum mismatch for {}", bin);
}
}
}
let bin_dir = opts.bin_dir.clone().unwrap_or_else(default_bin_dir);
fs::create_dir_all(&bin_dir)
.with_context(|| format!("failed to create {}", bin_dir.display()))?;
let dest = bin_dir.join(&bin);
if dest.exists() && !opts.force {
bail!(View on GitHub (pinned to a747e741ae)
Solutions
- Check the status code: 404 means the binary isn't published for that package/version/target — verify the version and target.
- Verify the registry URL configuration resolves to the correct registry.
- Re-publish the package if the binary was never uploaded.
- Retry if the status is 5xx (transient registry issue).
Example fix
null
Defensive patterns
Strategy: retry
Validate before calling
// Pre-flight: verify the binary entry exists in the manifest before downloading
let target_entry = manifest.targets.get(&target_triple)
.ok_or_else(|| format!("no binaries published for target {}", target_triple))?;
if !target_entry.sha256.contains_key(&bin) {
return Err(format!("binary {} not listed for target {}", bin, target_triple));
} Try / catch
match install(opts) {
Err(e) if e.to_string().contains("download failed") => {
if e.to_string().contains("404") {
eprintln!("Binary not published for this package/version/target — verify version and target triple.");
} else if e.to_string().contains("50") {
retry_with_backoff(3, || install(opts.clone()));
}
std::process::exit(1);
}
other => other,
} Prevention
- Verify the version exists and binaries were uploaded (not just the manifest).
- Confirm the target triple matches one published in the manifest.
- Double-check registry_url configuration before installs in CI.
- Retry on 5xx; treat 404 as a publishing gap, not transient.
When it happens
Trigger: GET on the resolved binary URL returning 404 (package/version/target not published), 401/403 (private package), or 5xx, after a successful manifest fetch.
Common situations: Requesting a version whose manifest exists but binaries were never uploaded; wrong target triple published; registry URL misconfigured pointing at the wrong host; package removed from the registry.
Related errors
- registry upload failed for {} ({})
- registry returned {}
- Download failed with status {}
- device auth start failed: HTTP {}
- device auth poll failed: HTTP {}
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/2308d244f4acddba.
Report an issue: GitHub.