nikivdev/code · error
Download failed with status {}
Error message
Download failed with status {} What it means
In `download_with_progress` (src/upgrade.rs:292-315), after `reqwest::Client::get(url).send()` succeeds at the HTTP transport level, the code checks `response.status().is_success()` and bails if the release asset server returned a non-2xx status. The upgrade flow aborts because the expected artifact could not be fetched.
Source
Thrown at src/upgrade.rs:301
if l < c {
return false;
}
}
latest_parts.len() > current_parts.len()
}
/// Download a file with progress indication.
fn download_with_progress(client: &Client, url: &str, dest: &Path) -> Result<()> {
let response = client
.get(url)
.header("User-Agent", format!("flow/{}", current_version()))
.timeout(Duration::from_secs(300))
.send()
.context("Failed to start download")?;
if !response.status().is_success() {
bail!("Download failed with status {}", response.status());
}
let total_size = response.content_length();
let mut file = File::create(dest).context("Failed to create temp file")?;
let bytes = response.bytes().context("Failed to read response")?;
if let Some(total) = total_size {
println!("Downloading {} bytes...", total);
}
file.write_all(&bytes)?;
Ok(())
}
fn github_token() -> Option<String> {
for key in ["GITHUB_TOKEN", "GH_TOKEN", "FLOW_GITHUB_TOKEN"] {
if let Ok(value) = env::var(key) {View on GitHub (pinned to a747e741ae)
Solutions
- Re-run after a few minutes if it was a 429/5xx (rate limit or transient server error).
- Set GITHUB_TOKEN (or GH_TOKEN / FLOW_GITHUB_TOKEN) to raise the rate limit and access private repos.
- Check that the release and asset actually exist: `gh release view <tag>` or open the repo's releases page.
- Verify network/proxy settings (HTTPS_PROXY) can reach github.com / objects.githubusercontent.com.
- Update via your package manager instead if the binary was installed that way.
Defensive patterns
Strategy: try-catch
Validate before calling
// check reachability & auth before upgrading
curl -sI "$ASSET_URL" | head -1 # expect HTTP/2 200
echo "${GITHUB_TOKEN:+token set}" # avoids 403 rate limits Try / catch
match upgrade::run() {
Err(e) if e.to_string().contains("Download failed with status") => {
eprintln!("Asset unavailable: {e}. Check release exists / set GITHUB_TOKEN / retry later.");
}
Err(e) => eprintln!("upgrade failed: {e}"),
Ok(()) => {}
} Prevention
- Export GITHUB_TOKEN to avoid unauthenticated rate limits (403).
- Verify the release/asset exists before scripting upgrades.
- Handle 429 with backoff instead of immediate retry.
- Check proxy env vars (HTTPS_PROXY) reach GitHub.
When it happens
Trigger: Calling `f upgrade` resolves a release asset URL and `client.get(url).send()` returns a 404 (asset/repo missing or renamed), 403 (rate limit, private repo without GITHUB_TOKEN/GH_TOKEN/FLOW_GITHUB_TOKEN), or 5xx.
Common situations: Hitting GitHub API rate limits (60 req/hr unauthenticated); upgrading a fork whose releases/assets were deleted; asset name changed between versions; corporate proxy or transient GitHub 5xx; private repository without a token set.
Related errors
- download failed ({})
- device auth start failed: HTTP {}
- device auth poll failed: HTTP {}
- Maple MCP request failed ({}): {}
- remote review failed: HTTP {}
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/990223ade9d24b7f.
Report an issue: GitHub.