zed-industries/zed · error · anyhow::Error
can't reconnect to room: client failed to re-establish conne
Error message
can't reconnect to room: client failed to re-establish connection
What it means
In Zed's collaboration call code, after losing the server connection the room logic waits to re-establish the connection and re-join the room. If that fails (connection never came back, or the re-join was rejected), the code leaves the room via `this.leave(cx)` and bails with this terminal error. The room is deliberately torn down rather than kept half-alive.
Source
Thrown at crates/call/src/call_impl/room.rs:447
continue;
}
Ok(false) => break,
Err(Timeout) => {
log::info!("room reconnection timeout expired");
break;
}
}
}
}
// The client failed to re-establish a connection to the server
// or an error occurred while trying to re-join the room. Either way
// we leave the room and return an error.
if let Some(this) = this.upgrade() {
log::info!("reconnection failed, leaving room");
this.update(cx, |this, cx| this.leave(cx)).await?;
}
anyhow::bail!("can't reconnect to room: client failed to re-establish connection");
}
fn rejoin(&mut self, cx: &mut Context<Self>) -> Task<Result<()>> {
let mut projects = HashMap::default();
let mut reshared_projects = Vec::new();
let mut rejoined_projects = Vec::new();
self.shared_projects.retain(|project| {
if let Some(handle) = project.upgrade() {
let project = handle.read(cx);
if let Some(project_id) = project.remote_id() {
projects.insert(project_id, handle.clone());
reshared_projects.push(proto::UpdateProject {
project_id,
worktrees: project.worktree_metadata_protos(cx),
});
return true;
}
}View on GitHub (pinned to f4178619ac)
Solutions
- Check network connectivity and retry: click the room/share link again to rejoin — the room was left cleanly, so rejoining is safe.
- If sign-in expired, re-authenticate to the collab server first, then rejoin.
- If the server was restarted, wait for it to come back and rejoin; shared project state re-shares on rejoin.
- For code embedding rooms, treat this error as 'room closed' — stop retry loops and update UI state rather than assuming the room still exists.
Defensive patterns
Strategy: retry
Validate before calling
// Before relying on a room after connection loss, check connection health
if !client.is_connected() {
client.reconnect().await?; // then rejoin
} Try / catch
match room_task {
Err(err) if err.to_string().contains("can't reconnect to room") => {
// room was left cleanly; safe to rejoin after connectivity returns
wait_for_connectivity().await;
room.rejoin().await
}
result => result,
} Prevention
- Handle this error as 'room closed': reset local room UI state instead of retrying the stale handle.
- Rejoin by room id/link after reconnecting; re-share happens automatically in `rejoin`.
- Avoid sleep/resume mid-call, or expect to rejoin on wake.
When it happens
Trigger: During an active call, the websocket to the collab server drops; the reconnect/rejoin task completes without successfully rejoining — network still down after the retry window, auth token expired mid-call, room deleted on the server, or the re-join request itself errored.
Common situations: Flaky Wi-Fi/VPN switching during a shared call; laptop sleep/resume while in a room; collab server restart/deploys; signed-out or token expiry during a long call.
Related errors
- archive links are not supported: {member.name}
- unknown judge preset '{name}' (valid: {valid})
- unsupported TOML value in .env.toml for key {}
- aborting reconnect, because not in state that allows reconne
- Timed out resyncing remote client
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/09502035774b0103.
Report an issue: GitHub.