jdx/mise · error

unsupported redirect

Error message

unsupported redirect

What it means

The GitHub relay's `forward` only follows redirects to asset-download or archive endpoints (the `asset_redirect`/`archive_redirect` helpers). When the GitHub API returns a 3xx whose Location is neither (or `target.git` is set), the relay refuses to follow it and bails with "unsupported redirect". This is a deliberate security policy: the relay must not be tricked into proxying arbitrary third-party hosts.

Solutions

  1. Update mise to the latest version so the relay's asset/archive redirect allowlist matches GitHub's current redirect hosts.
  2. Check what the redirect target actually is (curl -sIL <url>) — if it points to an unexpected host, you may be behind a proxy/DNS interception; fix that environment.
  3. If you need git operations, use the git capability path directly instead of routing a git target through the asset relay.
  4. Report the redirect URL/host to mise maintainers if GitHub introduced a new legitimate download host that is being rejected.

Example fix

// before: git targets can never follow redirects, causing the bail
if target.git || !(asset_redirect(&url) || archive_redirect(&url, target.archive_repo.as_deref())) {
    bail!("unsupported redirect");
}
// after (as a user): don't force git through the asset relay
let target = RelayTarget { git: false, ..target }; // or call the git endpoint path
Defensive patterns

Strategy: fallback

Try / catch

match relay_forward(target, parts).await {
    Err(e) if e.to_string().contains("unsupported redirect") => direct_download(parts).await,
    other => other,
}

Prevention

When it happens

Trigger: A request forwarded through the relay receives a redirect whose Location URL is not an asset or archive redirect; or a redirect Location that fails to parse (handled earlier) or points to a disallowed host/path; or a git-capability target that redirects anywhere at all (target.git short-circuits to bail).

Common situations: GitHub changes/changes shape of its release-asset or codeload redirect chain; a redirect to objects.githubusercontent.com variant the allowlist doesn't recognize; requesting a git operation through a relay path that only supports HTTP asset/archive forwarding; a misconfigured proxy or mirrors returning non-standard redirects.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/fb00dd9b64cd1bc4. Report an issue: GitHub.

Appendix: source

Thrown at src/github_relay.rs:669

        let mut response = req.body(body).send().await?;
        if broker.audit.options.log_requests {
            broker.audit.emit(serde_json::json!({"event": "request", "operation": operation, "status": response.status().as_u16(), "headers_ms": sent_at.elapsed().as_millis()}));
        }
        // Only asset redirects are followed. Preserve resume headers, never credentials.
        for _ in 0..3 {
            if !response.status().is_redirection() {
                break;
            }
            let location = response
                .headers()
                .get("location")
                .ok_or_else(|| eyre::eyre!("missing redirect"))?
                .to_str()?;
            let url = Url::parse(location)?;
            if target.git
                || !(asset_redirect(&url) || archive_redirect(&url, target.archive_repo.as_deref()))
            {
                bail!("unsupported redirect");
            }
            let redirect_host = url.host_str().unwrap_or_default().to_string();
            let redirected_at = std::time::Instant::now();
            let mut redirected = broker.client.request(parts.method.clone(), url);
            for name in ["range", "if-range"] {
                if let Some(value) = parts.headers.get(name) {
                    redirected = redirected.header(name, value);
                }
            }
            response = redirected.send().await?;
            if broker.audit.options.log_requests {
                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()}));
            }
        }
        if response.status().is_redirection() {
            bail!("too many redirects");
        }
        let mut builder = Response::builder().status(response.status());

View on GitHub (pinned to 533346cc37)