{"record":{"id":"2d332b009b5ed9fc","repo":"cjpais/Handy","slug":"error","errorCode":null,"errorMessage":"{:?}","messagePattern":"\\{:\\?\\}","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/managers/model.rs","lineNumber":2031,"sourceCode":"                        ATTEMPT_STREAMS.len(),\n                        model_id,\n                        stream_count,\n                        ATTEMPT_STREAMS[attempt],\n                        delay.as_secs()\n                    );\n                    tokio::select! {\n                        _ = tokio::time::sleep(delay) => {}\n                        _ = cancel_token.cancelled() => {\n                            info!(\"HF download cancelled for: {}\", model_id);\n                            return Ok(());\n                        }\n                    }\n                    attempt += 1;\n                }\n                Err(e) => {\n                    // {:?} keeps the error source chain (reset vs TLS vs timeout);\n                    // Display truncates it to \"error sending request\".\n                    let err = anyhow::anyhow!(\"{:?}\", e);\n                    if attempt >= ATTEMPT_STREAMS.len() {\n                        break Some(err);\n                    }\n                    let delay = Duration::from_secs(1_u64 << attempt);\n                    warn!(\n                        \"HF download attempt {}/{} failed for {} using {} concurrent stream(s): {}; retrying with {} stream(s) in {}s\",\n                        attempt,\n                        ATTEMPT_STREAMS.len(),\n                        model_id,\n                        stream_count,\n                        err,\n                        ATTEMPT_STREAMS[attempt],\n                        delay.as_secs()\n                    );\n                    tokio::select! {\n                        _ = tokio::time::sleep(delay) => {}\n                        _ = cancel_token.cancelled() => {\n                            info!(\"HF download cancelled for: {}\", model_id);","sourceCodeStart":2013,"sourceCodeEnd":2049,"githubUrl":"https://github.com/cjpais/Handy/blob/98a4d80cce8ad41efec2a419b59d9e81229a35d7/src-tauri/src/managers/model.rs#L2013-L2049","documentation":"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.","triggerScenarios":"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.","commonSituations":"Corporate TLS interception; DNS breakage after network switches; transient hub 5xx outages; IPv6 misconfiguration causing resets; firewall blocking large transfers.","solutions":["Read the full Debug chain in the log — the innermost source names the layer (dns, tls, tcp, http)","Check basic connectivity: curl -I https://huggingface.co","For TLS-intercepting proxies, ensure the corporate root CA is trusted by the system store","If transient, rely on the automatic retries/mirror fallback; if permanent, fix the network first"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"Err(e) => {\n    // {:?} preserves the source chain — log it whole before deciding to retry\n    warn!(\"hf-hub error: {e:?}\");\n    if attempt >= ATTEMPT_STREAMS.len() { break Some(anyhow::anyhow!(\"{e:?}\")); }\n}","preventionTips":["Always inspect the Debug-formatted chain; the innermost source identifies DNS vs TLS vs TCP vs HTTP","Verify egress to huggingface.co before long download sessions","Trust the built-in backoff ladder instead of adding manual retries that fight it"],"tags":["rust","hf-hub","network","error-chaining","retry"],"backgroundTag":"network-request-failed","analyzedSha":"98a4d80cce8ad41efec2a419b59d9e81229a35d7","analyzedAt":"2026-08-16T20:58:09.966Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}