{"record":{"id":"e3e500d213540d8d","repo":"jdx/mise","slug":"too-many-redirects","errorCode":null,"errorMessage":"too many redirects","messagePattern":"too many redirects","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/github_relay.rs","lineNumber":685,"sourceCode":"                || !(asset_redirect(&url) || archive_redirect(&url, target.archive_repo.as_deref()))\n            {\n                bail!(\"unsupported redirect\");\n            }\n            let redirect_host = url.host_str().unwrap_or_default().to_string();\n            let redirected_at = std::time::Instant::now();\n            let mut redirected = broker.client.request(parts.method.clone(), url);\n            for name in [\"range\", \"if-range\"] {\n                if let Some(value) = parts.headers.get(name) {\n                    redirected = redirected.header(name, value);\n                }\n            }\n            response = redirected.send().await?;\n            if broker.audit.options.log_requests {\n                broker.audit.emit(serde_json::json!({\"event\": \"request\", \"operation\": format!(\"{} {redirect_host}/<download>\", parts.method), \"status\": response.status().as_u16(), \"headers_ms\": redirected_at.elapsed().as_millis()}));\n            }\n        }\n        if response.status().is_redirection() {\n            bail!(\"too many redirects\");\n        }\n        let mut builder = Response::builder().status(response.status());\n        for name in [\n            \"content-type\",\n            \"content-length\",\n            \"content-range\",\n            \"etag\",\n            \"last-modified\",\n            \"link\",\n            // Rate-limit metadata. GitHub reports an exhausted limit as 403,\n            // so without these the caller cannot tell one from a refusal and\n            // retries nothing — see `is_github_rate_limited`. They describe\n            // the broker's own budget, which is what a caller needs in order\n            // to back off, and carry no credential.\n            \"retry-after\",\n            \"x-ratelimit-limit\",\n            \"x-ratelimit-remaining\",\n            \"x-ratelimit-reset\",","sourceCodeStart":667,"sourceCodeEnd":703,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/github_relay.rs#L667-L703","documentation":"After following the allowed number of redirects while proxying a GitHub download, the relay checks the final response: if it is still a 3xx redirection, it stops and bails with \"too many redirects\". This guards against redirect loops from GitHub or an intercepting middlebox.","triggerScenarios":"The asset/archive download chain returns more redirects than the relay's loop bound allows (the `loop { ... }` in `forward` exhausts its iterations and the last response status is_redirection); or a redirect cycle (A -> B -> A) exists in the chain.","commonSituations":"GitHub or the CDN issues a redirect loop; a corporate proxy rewrites Location headers producing a cycle; a stale/changed GitHub download host keeps 302-ing; rate-limit or auth middleware bouncing between endpoints.","solutions":["Retry the download — transient CDN redirect loops often resolve.","Inspect the redirect chain with `curl -sIL <asset-url>` to identify the loop or offending host; fix proxy/DNS if a middlebox is rewriting Location.","Update mise to pick up current redirect allowlist/limits if GitHub changed its download endpoints.","Download the artifact directly (outside the relay) if your network environment keeps looping through the proxy."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for attempt in 0..3 {\n    match relay_download(url).await {\n        Err(e) if e.to_string().contains(\"too many redirects\") && attempt < 2 => continue,\n        other => break other,\n    }\n}","preventionTips":["Retry transient redirect loops before giving up","Audit proxy configuration that rewrites Location headers","Verify the direct GitHub redirect chain with curl -sIL when downloads fail"],"tags":["http","redirect","loop","network","github"],"backgroundTag":"http-request-failed","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}