{"record":{"id":"e7f4cb1778316daf","repo":"cjpais/Handy","slug":"download-failed-from-hugging-face-and-mirr","errorCode":null,"errorMessage":"Download failed from Hugging Face ({}) and {} mirror(s)","messagePattern":"Download failed from Hugging Face \\((.+?)\\) and (.+?) mirror\\(s\\)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/managers/model.rs","lineNumber":2141,"sourceCode":"                {\n                    Ok(true) => {\n                        completed = true;\n                        break;\n                    }\n                    Ok(false) => {\n                        info!(\"Mirror download cancelled for: {}\", model_id);\n                        return Ok(());\n                    }\n                    Err(e) => {\n                        warn!(\n                            \"Mirror download failed for {} from {}: {:?}\",\n                            model_id, mirror.url, e\n                        );\n                    }\n                }\n            }\n            if !completed {\n                return Err(anyhow::anyhow!(\n                    \"Download failed from Hugging Face ({}) and {} mirror(s)\",\n                    hf_error,\n                    mirrors.len()\n                ));\n            }\n        }\n\n        cleanup.disarmed = true;\n        self.update_download_status()?;\n        self.cancel_flags.lock().unwrap().remove(&model_id);\n        let _ = self.app_handle.emit(\"model-download-complete\", &model_id);\n        info!(\"HF model {} downloaded\", model_id);\n        Ok(())\n    }\n\n    /// Direct-HTTP download of a catalog model's file from a mirror into the\n    /// models dir (HF-model resolution accepts that location too). Returns\n    /// `Ok(true)` on completion, `Ok(false)` if cancelled (partial kept).","sourceCodeStart":2123,"sourceCodeEnd":2159,"githubUrl":"https://github.com/cjpais/Handy/blob/ba10ce1943ef34e93c09494027fc0b9ced2e8a44/src-tauri/src/managers/model.rs#L2123-L2159","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the per-mirror warn! lines in the log — they tell you which mirror URLs failed and why","Restore network and retry; resume works via the shared partial cache","Manually download the file (from any reachable host) and place it in the models dir under model_info.filename","As a maintainer: prune dead mirrors from the catalog and add fresh ones"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// verify at least one target is reachable before spending minutes on HF\nasync fn any_target_reachable(mirrors: &[Mirror]) -> usize {\n    let mut ok = usize::from(hub_reachable().await);\n    for m in mirrors {\n        ok += usize::from(reqwest::Client::new().head(&m.url).send().await.is_ok());\n    }\n    ok\n}","typeGuard":null,"tryCatchPattern":"Err(e) if e.to_string().contains(\"and\") && e.to_string().contains(\"mirror\") => {\n    // all automated paths exhausted — offer manual install instead of another retry\n    ui.offer_manual_download(model_info.filename);\n}","preventionTips":["Keep the catalog's mirror list curated — dead mirrors waste the fallback budget","Document manual drop-in: place the file at models_dir/<filename> as a last resort","Aggregate the per-mirror warn! lines into the final error so users see why each mirror failed"],"tags":["rust","huggingface","mirror","download","fallback"],"backgroundTag":"all-download-mirrors-failed","analyzedSha":"ba10ce1943ef34e93c09494027fc0b9ced2e8a44","analyzedAt":"2026-08-17T10:29:55.597Z","contentChangedAt":"2026-08-17T10:29:55.597Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}