zed-industries/zed · error · anyhow::Error

Cloud WebSocket error: {error}

Error message

Cloud WebSocket error: {error}

What it means

The Cloud WebSocket reader task forwards any frame-level read error from the websocket stream into the message channel wrapped as 'Cloud WebSocket error: {error}'. It signals a failed or broken websocket frame after the connection was established.

Source

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

pub struct Connection {
    rx: SplitStream<WebSocket>,
}

impl Connection {
    fn new(websocket: WebSocket) -> Self {
        let (_, rx) = websocket.split();
        Self { rx }
    }

    pub fn spawn(self, cx: &App) -> (MessageStream, Task<()>) {
        let mut rx = self.rx;
        let (message_tx, message_rx) = unbounded();
        let task = cx.spawn(async move |_cx| {
            while let Some(frame) = rx.next().await {
                let frame = match frame {
                    Ok(frame) => frame,
                    Err(error) => {
                        let error = anyhow!("Cloud WebSocket error: {error}");
                        if message_tx.unbounded_send(Err(error)).is_err() {
                            break;
                        }
                        continue;
                    }
                };
                if !forward_frame(frame, &message_tx) {
                    break;
                }
            }
        });

        (message_rx.into_stream().boxed(), task)
    }
}

impl CloudApiClient {
    pub fn connect(self: &std::sync::Arc<Self>, cx: &App) -> Result<Task<Result<Connection>>> {

View on GitHub (pinned to bc538def45)

Solutions

  1. Treat the error as a disconnect: re-establish the Cloud WebSocket connection
  2. Enable websocket keep-alive/ping so intermediaries do not idle-timeout the stream
  3. Check network stability and any proxy websocket idle timeout settings
Defensive patterns

Strategy: retry

Try / catch

while let Some(frame) = message_rx.next().await {
    match frame {
        Ok(frame) => handle_frame(frame),
        Err(err) if err.to_string().starts_with("Cloud WebSocket error") => {
            // stream is dead: reconnect with backoff instead of continuing
            reconnect_with_backoff(&client, cx).await;
        }
        Err(err) => log::error!("unexpected stream error: {err:#}"),
    }
}

Prevention

When it happens

Trigger: rx.next() yields Err: connection reset mid-frame, TLS renegotiation failure, protocol violation from an intermediary, or the server aborting the websocket handshake state machine.

Common situations: Network interruptions during long-lived cloud sessions; proxies with idle timeouts killing websockets; MTU/fragmentation issues on VPN links.

Related errors


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