aaif-goose/goose · error

Download failed after {} retries: {}

Error message

Download failed after {} retries: {}

What it means

The initial reqwest request.send() failed at the transport level and the retry counter had already reached MAX_RETRIES = 10. Attempts used exponential backoff (2s doubling, capped at 60s) through cancellable_sleep; the final underlying reqwest error (DNS failure, connect refused/timeout, TLS error, proxy error) is included in the message. The client uses a 30s connect timeout.

Source

Thrown at crates/goose-download-manager/src/lib.rs:483

            let _ = tokio::fs::remove_file(&partial_path).await;
        }

        loop {
            if Self::is_cancelled(downloads, model_id) {
                let _ = tokio::fs::remove_file(&partial_path).await;
                anyhow::bail!("Download cancelled");
            }

            let mut request = Self::apply_bearer_token(client.get(url), bearer_token);
            if file_bytes > 0 {
                request = request.header("Range", format!("bytes={}-", file_bytes));
            }

            let response = match request.send().await {
                Ok(r) => r,
                Err(e) => {
                    if retries >= Self::MAX_RETRIES {
                        anyhow::bail!("Download failed after {} retries: {}", retries, e);
                    }
                    retries += 1;
                    let delay = std::cmp::min(
                        Self::RETRY_BASE_DELAY * 2u32.saturating_pow(retries - 1),
                        Self::RETRY_MAX_DELAY,
                    );
                    info!(model_id = %model_id, retry = retries, delay_secs = ?delay.as_secs(), error = %e, "Retrying download after connection error");
                    Self::cancellable_sleep(delay, downloads, model_id).await?;
                    continue;
                }
            };

            let status = response.status();
            if status == reqwest::StatusCode::RANGE_NOT_SATISFIABLE {
                if file_total > 0 && file_bytes == file_total {
                    break;
                }
                *cumulative_bytes = cumulative_bytes.saturating_sub(file_bytes);

View on GitHub (pinned to 3810898a74)

Solutions

  1. Verify basic reachability: curl -I on the exact URL from the same machine and environment
  2. Check HTTP_PROXY / HTTPS_PROXY / NO_PROXY settings and VPN/pro interference
  3. Fix DNS or switch networks, then restart the download (it resumes from the .partial file)
  4. If the host is temporarily down, retry after the outage clears
Defensive patterns

Strategy: retry

Validate before calling

// cheap preflight before a long download: HEAD must reach the host
let ok = reqwest::Client::new().head(url).send().await.map(|r| r.status().is_success()).unwrap_or(false);
if !ok { /* fix connectivity/proxy first; do not enter the download loop */ }

Try / catch

if err.to_string().starts_with("Download failed after") {
    // library already did 10 attempts with backoff: run a connectivity check,
    // fix DNS/proxy/VPN, then restart the download - it resumes from the .partial file
}

Prevention

When it happens

Trigger: Ten consecutive send() failures for one file: no DNS resolution for the HF host, unreachable network, firewall or TLS-intercepting proxy rejecting the connection, or wrong HTTP(S)_PROXY environment variables.

Common situations: Offline machines, corporate proxies requiring auth, VPN split-tunnel dropping huggingface.co, captive portals, IPv6 misconfiguration, CDN regional outages sustained across the full backoff window.

Related errors


AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16). Data as JSON: /api/errors/87015f74632571c4. Report an issue: GitHub.