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
- Treat the error as a disconnect: re-establish the Cloud WebSocket connection
- Enable websocket keep-alive/ping so intermediaries do not idle-timeout the stream
- 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
- Design consumers to reconnect on stream errors rather than propagate them
- Keep websocket ping/pong alive through proxies with idle timeouts
- Distinguish frame errors (reconnect) from auth errors (stop)
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
- invalid URL scheme: {scheme}
- failed to connect to Cloud WebSocket: {error}
- app '{args.app_name}' not deployed (or function '{function_n
- Slack webhook returned {response.status_code}: {response.tex
- GraphQL failed after {retries} retries: {last_err}
AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16).
Data as JSON: /api/errors/ed8da17b382564cf.
Report an issue: GitHub.