{"record":{"id":"09502035774b0103","repo":"zed-industries/zed","slug":"can-t-reconnect-to-room-client-failed-to-re-estab","errorCode":null,"errorMessage":"can't reconnect to room: client failed to re-establish connection","messagePattern":"can't reconnect to room: client failed to re-establish connection","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/call/src/call_impl/room.rs","lineNumber":447,"sourceCode":"                        continue;\n                    }\n                    Ok(false) => break,\n                    Err(Timeout) => {\n                        log::info!(\"room reconnection timeout expired\");\n                        break;\n                    }\n                }\n            }\n        }\n\n        // The client failed to re-establish a connection to the server\n        // or an error occurred while trying to re-join the room. Either way\n        // we leave the room and return an error.\n        if let Some(this) = this.upgrade() {\n            log::info!(\"reconnection failed, leaving room\");\n            this.update(cx, |this, cx| this.leave(cx)).await?;\n        }\n        anyhow::bail!(\"can't reconnect to room: client failed to re-establish connection\");\n    }\n\n    fn rejoin(&mut self, cx: &mut Context<Self>) -> Task<Result<()>> {\n        let mut projects = HashMap::default();\n        let mut reshared_projects = Vec::new();\n        let mut rejoined_projects = Vec::new();\n        self.shared_projects.retain(|project| {\n            if let Some(handle) = project.upgrade() {\n                let project = handle.read(cx);\n                if let Some(project_id) = project.remote_id() {\n                    projects.insert(project_id, handle.clone());\n                    reshared_projects.push(proto::UpdateProject {\n                        project_id,\n                        worktrees: project.worktree_metadata_protos(cx),\n                    });\n                    return true;\n                }\n            }","sourceCodeStart":429,"sourceCodeEnd":465,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/call/src/call_impl/room.rs#L429-L465","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Before relying on a room after connection loss, check connection health\nif !client.is_connected() {\n    client.reconnect().await?; // then rejoin\n}","typeGuard":null,"tryCatchPattern":"match room_task {\n    Err(err) if err.to_string().contains(\"can't reconnect to room\") => {\n        // room was left cleanly; safe to rejoin after connectivity returns\n        wait_for_connectivity().await;\n        room.rejoin().await\n    }\n    result => result,\n}","preventionTips":["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."],"tags":["collab","call","room","reconnect","websocket"],"backgroundTag":"room-reconnection-failed","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}