{"record":{"id":"4b8e6c3099ece353","repo":"cjpais/Handy","slug":"hugging-face-download-failed-after-attempt-s","errorCode":null,"errorMessage":"Hugging Face download failed after {} attempt(s): {}","messagePattern":"Hugging Face download failed after (.+?) attempt\\(s\\): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/managers/model.rs","lineNumber":2111,"sourceCode":"                        _ = cancel_token.cancelled() => {\n                            info!(\"HF download cancelled for: {}\", model_id);\n                            return Ok(());\n                        }\n                    }\n                    attempt += 1;\n                }\n            }\n        };\n\n        if let Some(hf_error) = hf_error {\n            // `attempt`, not the schedule length: a sequential stall breaks out early.\n            error!(\n                \"HF download failed for {} after {} attempt(s): {:?}\",\n                model_id, attempt, hf_error\n            );\n            let mirrors = crate::catalog::mirror_fallbacks(&model_id);\n            if mirrors.is_empty() {\n                return Err(anyhow::anyhow!(\n                    \"Hugging Face download failed after {} attempt(s): {}\",\n                    attempt,\n                    hf_error\n                ));\n            }\n            let mut completed = false;\n            for mirror in &mirrors {\n                info!(\"Falling back to mirror for {}: {}\", model_id, mirror.url);\n                match self\n                    .download_from_mirror(&model_id, &filename, mirror, cancel_token.clone())\n                    .await\n                {\n                    Ok(true) => {\n                        completed = true;\n                        break;\n                    }\n                    Ok(false) => {\n                        info!(\"Mirror download cancelled for: {}\", model_id);","sourceCodeStart":2093,"sourceCodeEnd":2129,"githubUrl":"https://github.com/cjpais/Handy/blob/ba10ce1943ef34e93c09494027fc0b9ced2e8a44/src-tauri/src/managers/model.rs#L2093-L2129","documentation":"Every attempt in the ATTEMPT_STREAMS schedule failed (or a single-stream attempt stalled and broke out early), and the catalog's mirror_fallbacks() list for this model is empty, so the download manager gives up and reports the attempt count plus the last hf_error. The attempt number reflects the early-exit position, not the schedule length. This is the terminal error for download_model on HuggingFace-sourced models without mirrors.","triggerScenarios":"Total network outage or huggingface.co blocked by firewall/region; the HF repo was removed, renamed, or made private so every attempt fails identically; disk-full causing every write to fail; all attempts stalled sequentially on a dead link with no mirror configured.","commonSituations":"Corporate/region firewalls blocking huggingface.co; deprecated model repos pulled from the Hub; full disk during multi-GB downloads; transient HF outage that outlasts the retry schedule.","solutions":["Verify outbound reachability of huggingface.co (curl -I https://huggingface.co) from the same machine","Free disk space — model files are multi-GB and writes fail silently as generic errors","Retry once network/Hub status recovers; the download resumes from the cached .sync.part","Manually download the model file and drop it into the models dir with the expected filename (get_model_path accepts manual drop-ins)","As a maintainer: add a mirror fallback for this model in the catalog so the mirror path can absorb Hub outages"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// cheap reachability preflight before a multi-GB attempt\nasync fn hub_reachable() -> bool {\n    reqwest::get(\"https://huggingface.co\")\n        .await\n        .map(|r| r.status().is_success() || r.status() == reqwest::StatusCode::FORBIDDEN)\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match manager.download_model(id).await {\n    Err(e) if e.to_string().contains(\"download failed after\") => {\n        // transient/Hub-side failure with no mirror — safe to offer a user-initiated retry later\n        ui.show_retry_later(e);\n    }\n    other => other?,\n}","preventionTips":["Check disk space before downloads: models are multi-GB and failures masquerade as generic errors","Give models mirror_fallbacks entries in the catalog so Hub outages have an escape path","Surface the trailing hf_error (it's {:?}-printed in the log) instead of just the attempt count"],"tags":["rust","huggingface","download","retries","network"],"backgroundTag":"download-failed-after-retries","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"}