Hmbown/CodeWhale · error
download returned
Error message
download {url} returned {status} What it means
`download_with_cap` performs the actual GET and bails on any non-success status, except 404 which is reported as `DownloadAttempt::NotFound` so callers can try the next candidate URL. Other failures (401, 403, 5xx) abort immediately with this error.
Solutions
- Fix the underlying HTTP cause: add auth/token for private repos, wait out rate limits
- Retry on transient 5xx with backoff
- Provide an alternative direct tarball URL that is publicly reachable
Example fix
// before let bytes = download_first_success(&["https://github.com/acme/priv/archive/refs/heads/main.tar.gz"], &network, MAX).await?; // after — mirror to a public, token-free URL let bytes = download_first_success(&["https://downloads.example.com/priv-main.tar.gz"], &network, MAX).await?;
Defensive patterns
Strategy: try-catch
Try / catch
match download_with_cap(url, &network, MAX).await {
Ok(DownloadAttempt::NotFound(status)) => try_next_url(),
Err(e) if e.to_string().contains("returned") => {
if e.to_string().contains("500") || e.to_string().contains("503") { retry_with_backoff(); }
}
other => other?,
} Prevention
- Authenticate private-repo downloads or mirror publicly
- Handle 404 as fall-through to alternate URLs, other statuses as fatal
- Monitor host rate limits before bulk installs
When it happens
Trigger: The GET of a specific candidate URL returned e.g. 403 (private repo, rate limit) or 500; only 404 is tolerated and treated as try-next-URL.
Common situations: Downloading from a private GitHub repo without a token (403); registry/host rate limiting; transient 502/503 from a CDN; typo'd direct URL pointing at a protected path.
Related errors
- download failed with HTTP
- failed to download skill
- The update could not be downloaded. Your current app is…
- too many redirects starting at
- Anthropic API error (HTTP )
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/f2511181f389f043.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/skills/install.rs:1159
Bytes(Vec<u8>),
NotFound(reqwest::StatusCode),
}
/// Stream a URL into memory with a size cap. Aborts on the first read that
/// would push the buffer over `max_size * 4` (the *4 accounts for compression;
/// the unpack step still enforces `max_size` on the *uncompressed* bytes).
async fn download_with_cap(url: &str, max_size: u64) -> Result<DownloadAttempt> {
let resp = reqwest_client()
.get(url)
.send()
.await
.with_context(|| format!("failed to GET {url}"))?;
let status = resp.status();
if !status.is_success() {
if status == reqwest::StatusCode::NOT_FOUND {
return Ok(DownloadAttempt::NotFound(status));
}
bail!("download {url} returned {status}");
}
// Soft cap on the *compressed* download — well above max_size to allow
// for highly compressible payloads but still bounded.
let compressed_cap = max_size.saturating_mul(4);
let bytes = resp
.bytes()
.await
.with_context(|| format!("failed to read body of {url}"))?;
if (bytes.len() as u64) > compressed_cap {
bail!("download {url} exceeds compressed size cap of {compressed_cap} bytes");
}
Ok(DownloadAttempt::Bytes(bytes.to_vec()))
}
struct StagedSkill {
skill_name: String,
staged_path: PathBuf,
}View on GitHub (pinned to 73e0f67d83)