cjpais/Handy · error · anyhow::Error

{:?}

Error message

{:?}

What it means

Catch-all for hf-hub ApiError variants other than the two Cancelled cases, formatted with {:?} on purpose: Debug keeps the error source chain (TLS vs connect vs response decode), while Display collapses it to 'error sending request'. Typical inner causes: DNS resolution failure, TLS handshake error, connection reset by peer, HTTP status/redirect errors, or a malformed response.

Source

Thrown at src-tauri/src/managers/model.rs:2031

                        ATTEMPT_STREAMS.len(),
                        model_id,
                        stream_count,
                        ATTEMPT_STREAMS[attempt],
                        delay.as_secs()
                    );
                    tokio::select! {
                        _ = tokio::time::sleep(delay) => {}
                        _ = cancel_token.cancelled() => {
                            info!("HF download cancelled for: {}", model_id);
                            return Ok(());
                        }
                    }
                    attempt += 1;
                }
                Err(e) => {
                    // {:?} keeps the error source chain (reset vs TLS vs timeout);
                    // Display truncates it to "error sending request".
                    let err = anyhow::anyhow!("{:?}", e);
                    if attempt >= ATTEMPT_STREAMS.len() {
                        break Some(err);
                    }
                    let delay = Duration::from_secs(1_u64 << attempt);
                    warn!(
                        "HF download attempt {}/{} failed for {} using {} concurrent stream(s): {}; retrying with {} stream(s) in {}s",
                        attempt,
                        ATTEMPT_STREAMS.len(),
                        model_id,
                        stream_count,
                        err,
                        ATTEMPT_STREAMS[attempt],
                        delay.as_secs()
                    );
                    tokio::select! {
                        _ = tokio::time::sleep(delay) => {}
                        _ = cancel_token.cancelled() => {
                            info!("HF download cancelled for: {}", model_id);

View on GitHub (pinned to 98a4d80cce)

Solutions

  1. Read the full Debug chain in the log — the innermost source names the layer (dns, tls, tcp, http)
  2. Check basic connectivity: curl -I https://huggingface.co
  3. For TLS-intercepting proxies, ensure the corporate root CA is trusted by the system store
  4. If transient, rely on the automatic retries/mirror fallback; if permanent, fix the network first
Defensive patterns

Strategy: retry

Try / catch

Err(e) => {
    // {:?} preserves the source chain — log it whole before deciding to retry
    warn!("hf-hub error: {e:?}");
    if attempt >= ATTEMPT_STREAMS.len() { break Some(anyhow::anyhow!("{e:?}")); }
}

Prevention

When it happens

Trigger: Any non-cancel hf-hub failure during download_model's attempt loop: offline machine, DNS for huggingface.co failing, TLS-intercepting proxy with a bad cert, connection reset mid-transfer, 5xx from the hub. The loop retries (ATTEMPT_STREAMS = [4, 1, 1, 1]) before this surfaces.

Common situations: Corporate TLS interception; DNS breakage after network switches; transient hub 5xx outages; IPv6 misconfiguration causing resets; firewall blocking large transfers.

Related errors


AI-assisted analysis of cjpais/Handy@98a4d80cce (2026-08-16). Data as JSON: /api/errors/2d332b009b5ed9fc. Report an issue: GitHub.