cjpais/Handy · error · anyhow::Error

Hugging Face download failed after {} attempt(s): {}

Error message

Hugging Face download failed after {} attempt(s): {}

What it means

Terminal failure of download_hf_model when every attempt in the stream/backoff ladder failed and crate::catalog::mirror_fallbacks(&model_id) returned no mirrors for that model. attempt is the actual attempt counter, not the schedule length, because a sequential stall breaks out early.

Source

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

                        _ = cancel_token.cancelled() => {
                            info!("HF download cancelled for: {}", model_id);
                            return Ok(());
                        }
                    }
                    attempt += 1;
                }
            }
        };

        if let Some(hf_error) = hf_error {
            // `attempt`, not the schedule length: a sequential stall breaks out early.
            error!(
                "HF download failed for {} after {} attempt(s): {:?}",
                model_id, attempt, hf_error
            );
            let mirrors = crate::catalog::mirror_fallbacks(&model_id);
            if mirrors.is_empty() {
                return Err(anyhow::anyhow!(
                    "Hugging Face download failed after {} attempt(s): {}",
                    attempt,
                    hf_error
                ));
            }
            let mut completed = false;
            for mirror in &mirrors {
                info!("Falling back to mirror for {}: {}", model_id, mirror.url);
                match self
                    .download_from_mirror(&model_id, &filename, mirror, cancel_token.clone())
                    .await
                {
                    Ok(true) => {
                        completed = true;
                        break;
                    }
                    Ok(false) => {
                        info!("Mirror download cancelled for: {}", model_id);

View on GitHub (pinned to 98a4d80cce)

Solutions

  1. Restore connectivity to huggingface.co (DNS, proxy, firewall) and retry the download
  2. Check whether the model has a mirror in catalog::mirror_fallbacks — if yes this error is unexpected and the mirror logs hold the real cause
  3. As a workaround, download the model file manually into the models directory and rescan
Defensive patterns

Strategy: retry

Try / catch

match manager.download_model(id).await {
    Ok(()) => (),
    Err(e) if e.to_string().starts_with("Hugging Face download failed") => {
        // transient network exhaustion — inform and let the user retry later
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Persistent network failure (offline, DNS down, firewall blocking huggingface.co) across all 4→1→1→1 stream attempts with exponential backoff, for a model that has no mirror entry in the catalog.

Common situations: Fully offline machines; firewalls that whitelist only blob.handy.computer and block huggingface.co; hub outages for repos without mirrors; long-running downloads on unstable links that stall past every retry.

Related errors


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