{"record":{"id":"c9ce64d98ff58c67","repo":"jdx/mise","slug":"retry-loop-should-always-return","errorCode":null,"errorMessage":"retry loop should always return","messagePattern":"retry loop should always return","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/vfox/src/http.rs","lineNumber":173,"sourceCode":"            Ok(value) => return Ok(value),\n            Err(err) => {\n                if !is_transient(&err) || attempt + 1 >= attempts {\n                    return Err(err);\n                }\n                let delay = retry_delay(attempt);\n                log::warn!(\n                    \"HTTP {} attempt {} failed (transient): {}; retrying in {:?}\",\n                    url,\n                    attempt + 1,\n                    err,\n                    delay\n                );\n                last_err = Some(err);\n                tokio::time::sleep(delay).await;\n            }\n        }\n    }\n    Err(last_err.expect(\"retry loop should always return\"))\n}\n","sourceCodeStart":155,"sourceCodeEnd":175,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/crates/vfox/src/http.rs#L155-L175","documentation":"retry_async loops a fixed number of attempts and is written so the loop always terminates via return/continue paths, leaving last_err populated on exhaustion. The final Err(last_err.expect(...)) panics only if the loop somehow exits with no recorded error — an internal invariant, not a user-triggerable condition.","triggerScenarios":"Only via a logic bug in retry_async's control flow (e.g. future retry-handling changes) where all attempts are consumed without assigning last_err.","commonSituations":"Effectively never seen by users; appears only in modified/patched builds or as a crash report from a mise bug.","solutions":["Report as a mise bug (github.com/jdx/mise/issues) with the original wrapped network error and version","Retry the download — the underlying failure is whatever last_err was (typically network/HTTP)","Check connectivity/proxy settings if downloads were failing before the panic"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// unreachable in practice; treat any occurrence as a bug report\nif msg.contains('retry loop should always return') { report_bug_with_env(); }","preventionTips":["Retry failed downloads; the real cause is the wrapped network error","Keep mise updated so retry-logic regressions are patched","Include `mise doctor` output when filing the bug"],"tags":["http","retry","panic","invariant","vfox"],"backgroundTag":"internal-invariant-violation","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}