zed-industries/zed · error

failed to connect to Cloud WebSocket

Error message

failed to connect to Cloud WebSocket: {error}

What it means

Raised when the async WebSocket handshake to the Zed Cloud /client/users/connect endpoint fails (DNS failure, TCP refusal, TLS error, or HTTP upgrade rejection). The connect future itself errored before the timeout elapsed.

Solutions

  1. Verify network connectivity and that the Zed Cloud service is reachable
  2. Check authentication/credentials if the server rejects the upgrade request
  3. Retry after transient network failures; the caller receives the task's Result and may re-invoke connect
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/cloud_api_client/src/websocket/web.rs:72 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/0cc37bbcdd86e180. Report an issue: GitHub.

Appendix: source

Thrown at crates/cloud_api_client/src/websocket/web.rs:72

        let executor = cx.background_executor().clone();
        Ok(cx.spawn(async move |_cx| {
            let mut connect_url = client
                .http_client
                .build_zed_cloud_url("/client/users/connect")?;
            connect_url
                .set_scheme(match connect_url.scheme() {
                    "https" => "wss",
                    "http" => "ws",
                    scheme => return Err(anyhow!("invalid URL scheme: {scheme}")),
                })
                .map_err(|_| anyhow!("failed to set URL scheme"))?;


            let connect = WebSocket::connect(connect_url).fuse();
            let timeout = executor.timer(CONNECT_TIMEOUT).fuse();
            futures::pin_mut!(connect, timeout);
            let websocket = futures::select_biased! {
                result = connect => result.map_err(|error| anyhow!("failed to connect to Cloud WebSocket: {error}"))?,
                _ = timeout => return Err(anyhow!("timed out connecting to Cloud WebSocket")),
            };

            Ok(Connection::new(websocket))
        }))
    }
}

View on GitHub (pinned to f4178619ac)