cjpais/Handy · error · anyhow::Error

Download failed from Hugging Face

Error message

Download failed from Hugging Face ({}) and {} mirror(s)

What it means

The terminal failure for HuggingFace downloads: the primary HF attempt(s) failed AND every mirror in catalog::mirror_fallbacks also failed (each logged as 'Mirror download failed for ... from ...'). hf_error summarizes the primary error and mirrors.len() counts the alternates tried. At this point all automated recovery paths — stream-count backoff, sequential retry, mirror fallback — are exhausted.

Solutions

  1. Check the per-mirror warn! lines in the log — they tell you which mirror URLs failed and why
  2. Restore network and retry; resume works via the shared partial cache
  3. Manually download the file (from any reachable host) and place it in the models dir under model_info.filename
  4. As a maintainer: prune dead mirrors from the catalog and add fresh ones
Defensive patterns

Strategy: fallback

Validate before calling

// verify at least one target is reachable before spending minutes on HF
async fn any_target_reachable(mirrors: &[Mirror]) -> usize {
    let mut ok = usize::from(hub_reachable().await);
    for m in mirrors {
        ok += usize::from(reqwest::Client::new().head(&m.url).send().await.is_ok());
    }
    ok
}

Try / catch

Err(e) if e.to_string().contains("and") && e.to_string().contains("mirror") => {
    // all automated paths exhausted — offer manual install instead of another retry
    ui.offer_manual_download(model_info.filename);
}

Prevention

When it happens

Trigger: Machine fully offline so HF and all mirrors fail identically; a mirror URL rotting (dead host, moved file, TLS cert expired); disk full so all targets fail on write; firewall allowing only huggingface.co and blocking mirror domains.

Common situations: Airplane mode / dropped connection mid-fallback; community mirrors (e.g. hf-mirror) going dark or relocating files; restrictive corporate allowlists that whitelist one domain only.

Related errors


AI-assisted analysis of cjpais/Handy@ba10ce1943 (2026-08-17). Data as JSON: /api/errors/e7f4cb1778316daf. Report an issue: GitHub.

Appendix: source

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

                {
                    Ok(true) => {
                        completed = true;
                        break;
                    }
                    Ok(false) => {
                        info!("Mirror download cancelled for: {}", model_id);
                        return Ok(());
                    }
                    Err(e) => {
                        warn!(
                            "Mirror download failed for {} from {}: {:?}",
                            model_id, mirror.url, e
                        );
                    }
                }
            }
            if !completed {
                return Err(anyhow::anyhow!(
                    "Download failed from Hugging Face ({}) and {} mirror(s)",
                    hf_error,
                    mirrors.len()
                ));
            }
        }

        cleanup.disarmed = true;
        self.update_download_status()?;
        self.cancel_flags.lock().unwrap().remove(&model_id);
        let _ = self.app_handle.emit("model-download-complete", &model_id);
        info!("HF model {} downloaded", model_id);
        Ok(())
    }

    /// Direct-HTTP download of a catalog model's file from a mirror into the
    /// models dir (HF-model resolution accepts that location too). Returns
    /// `Ok(true)` on completion, `Ok(false)` if cancelled (partial kept).

View on GitHub (pinned to ba10ce1943)