jdx/mise · error

unsupported relay host

Error message

unsupported relay host

What it means

After validating scheme/credentials/port, `request` maps the URL host to a relay prefix: api.github.com -> "api", github.com -> "web". Any other host cannot be proxied and produces "unsupported relay host". The relay is intentionally restricted to GitHub API and web endpoints.

Solutions

  1. Use only api.github.com or github.com URLs with this relay path.
  2. For other hosts (raw/objects CDN, enterprise), fetch directly with a normal HTTP client instead of the relay.
  3. Fix base-URL configuration that substitutes an enterprise or mirror host for GitHub.
  4. If you're hitting a suspicious host, check DNS/hosts-file tampering — the exact-host match may be protecting you.

Example fix

// before
let url = Url::parse("https://raw.githubusercontent.com/foo/bar/main/README.md")?;
relay_request(&url).await?; // bails: unsupported relay host
// after
let resp = reqwest::get(url).await?; // fetch non-GitHub hosts directly
Defensive patterns

Strategy: validation

Validate before calling

fn relay_host_ok(url: &reqwest::Url) -> bool {
    matches!(url.host_str(), Some("api.github.com") | Some("github.com"))
}

Try / catch

if relay_host_ok(&url) { relay_request(&url).await } else { reqwest::get(url).await.map_err(Into::into) }

Prevention

When it happens

Trigger: Requesting a URL whose host is not exactly api.github.com or github.com (case/whitespace aside), e.g. objects.githubusercontent.com, gist.github.com, an enterprise GitHub host (github.example.com), or raw.githubusercontent.com through the relay request path.

Common situations: Following a redirect or API-provided URL (e.g. raw.githubusercontent.com) back through the relay; GitHub Enterprise Server users pointing tooling at their own host; typos like api.github.com.evil.com or api,ggithub.com.

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/44347dec3996dbc2. Report an issue: GitHub.

Appendix: source

Thrown at src/github_relay.rs:995

    /// API adapter: an HTTP request over the forwarded private socket. No upstream
    /// authentication headers are sent to the target or supplied by the target.
    pub(crate) async fn request(
        socket: &Path,
        method: Method,
        url: &Url,
        headers: &http::HeaderMap,
    ) -> Result<reqwest::Response> {
        if url.scheme() != "https"
            || !url.username().is_empty()
            || url.password().is_some()
            || url.port().is_some()
        {
            bail!("unsupported relay destination");
        }
        let prefix = match url.host_str() {
            Some("api.github.com") => "api",
            Some("github.com") => "web",
            _ => bail!("unsupported relay host"),
        };
        let mut relay_url = Url::parse(&format!("http://localhost/{prefix}{}", url.path()))?;
        relay_url.set_query(url.query());
        let (client, request_timeout) = adapter_client(socket).await?;
        let mut req = client.request(method, relay_url);
        for name in ["accept", "range", "if-range"] {
            if let Some(value) = headers.get(name) {
                req = req.header(name, value);
            }
        }
        send_adapter_request(req, request_timeout).await
    }

    // Obtain the initiating machine's policy, not the target's saved settings.
    // Discovery itself has a short fixed bound and bypasses broker request slots.
    async fn adapter_client(socket: &Path) -> Result<(Client, Duration)> {
        let builder = || {
            Client::builder()

View on GitHub (pinned to 533346cc37)