zed-industries/zed · error

unexpected /rpc response status {}

Error message

unexpected /rpc response status {}

What it means

To discover the collab RPC endpoint, the client GETs /rpc and requires an HTTP 3xx redirect, reading the target from the Location header. Any non-redirect status (200, 404, 500, ...) fails with this error including the actual status code.

Source

Thrown at crates/client/src/client.rs:1310

            #[cfg(any(test, feature = "test-support"))]
            if let Some(url) = url_override {
                return Ok(url);
            }

            if let Some(url) = &*ZED_RPC_URL {
                return Url::parse(url).context("invalid rpc url");
            }

            let mut url = http.build_url("/rpc");
            if let Some(preview_param) =
                release_channel.and_then(|channel| channel.release_query_param())
            {
                url += "?";
                url += preview_param;
            }

            let response = http.get(&url, Default::default(), false).await?;
            anyhow::ensure!(
                response.status().is_redirection(),
                "unexpected /rpc response status {}",
                response.status()
            );
            let collab_url = response
                .headers()
                .get("Location")
                .context("missing location header in /rpc response")?
                .to_str()
                .map_err(EstablishConnectionError::other)?
                .to_string();
            Url::parse(&collab_url).with_context(|| format!("parsing collab rpc url {collab_url}"))
        }
    }

    fn establish_websocket_connection(
        self: &Arc<Self>,
        credentials: &Credentials,

View on GitHub (pinned to bc538def45)

Solutions

  1. Check the configured server URL and confirm `curl -I https://<server>/rpc` returns a 3xx with a Location header
  2. Fix the reverse proxy so /rpc is passed through to the collab server instead of being intercepted
  3. If running a custom server, redeploy a version that implements the /rpc redirect

Example fix

# verify expected behavior
$ curl -sI https://zed.dev/rpc
HTTP/2 302
location: <collab-url>
Defensive patterns

Strategy: validation

Validate before calling

# preflight: /rpc must redirect before pointing Zed at a custom server
status=$(curl -s -o /dev/null -w '%{http_code}' "https://$SERVER/rpc")
case "$status" in 3*) ;; *) echo "/rpc returned $status, not a redirect" >&2; exit 2 ;; esac

Try / catch

let response = http.get(&url, Default::default(), false).await?;
if !response.status().is_redirection() {
    // classify: 200 usually means a proxy intercepted; 404/5xx means wrong endpoint
    log::warn!("/rpc returned {}; check server config", response.status());
    return Err(anyhow!("unexpected /rpc response status {}", response.status()));
}

Prevention

When it happens

Trigger: The /rpc URL (optionally with a release-channel query param) responds without a redirection: the configured server does not implement the /rpc redirect, a reverse proxy answers the path itself, or an auth portal intercepts with 200.

Common situations: ZED_SERVER_URL pointing at a plain website or wrong subdomain; self-hosted setups where the redirect endpoint is missing; captive portals / SSO proxies returning 200 on all paths.

Related errors


AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16). Data as JSON: /api/errors/62745a4943741f4a. Report an issue: GitHub.