{"record":{"id":"7313ed6e7a259b54","repo":"zed-industries/zed","slug":"timed-out-resyncing-remote-client","errorCode":null,"errorMessage":"Timed out resyncing remote client","messagePattern":"Timed out resyncing remote client","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/remote/src/remote_client.rs","lineNumber":1940,"sourceCode":"        let response =\n            self.request_dynamic(payload.into_envelope(0, None, None), T::NAME, use_buffer);\n        async move {\n            let response = response.await?;\n            log::debug!(\"remote request finish. name:{}\", T::NAME);\n            T::Response::from_envelope(response).context(\"received a response of the wrong type\")\n        }\n    }\n\n    async fn resync(&self, timeout: Duration) -> Result<()> {\n        smol::future::or(\n            async {\n                self.request_internal(proto::FlushBufferedMessages {}, false)\n                    .await?;\n\n                for envelope in self.buffer.lock().iter() {\n                    self.outgoing_tx\n                        .lock()\n                        .unbounded_send(envelope.clone())\n                        .ok();\n                }\n                Ok(())\n            },\n            async {\n                self.executor.timer(timeout).await;\n                anyhow::bail!(\"Timed out resyncing remote client\")\n            },\n        )\n        .await\n    }\n\n    async fn ping(&self, timeout: Duration) -> Result<()> {\n        smol::future::or(\n            async {\n                self.request(proto::Ping {}).await?;\n                Ok(())\n            },","sourceCodeStart":1922,"sourceCodeEnd":1958,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/remote/src/remote_client.rs#L1922-L1958","documentation":"After a connection is re-established, the client resyncs: it flushes every buffered outgoing envelope and awaits the remote's acknowledgment. The resync future is raced against an executor timer via smol::future::or (crates/remote/src/remote_client.rs:1919); if the timer fires first, the resync fails with this timeout.","triggerScenarios":"The resync handshake does not complete within the timeout Duration passed to resync - slow or lossy links, a remote server that accepted the connection but is hung, or a very large buffered backlog replaying slowly.","commonSituations":"High-latency SSH tunnels; remote host under load during server startup; Wi-Fi flapping right after reconnect.","solutions":["Retry the connection - reconnect flows re-attempt resync with backoff","Check latency and bandwidth to the host; shrink in-flight state (fewer open projects/buffers) if the replayed backlog is huge","If it consistently times out, kill the stale zed-remote-server process on the host so a fresh one starts"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"let mut backoff = Duration::from_secs(1);\nloop {\n    match client.connect(&cx).await {\n        Ok(client) => break client,\n        Err(e) if e.to_string().contains(\"Timed out resyncing\") => {\n            timer(backoff).await;\n            backoff = backoff.saturating_mul(2);\n        }\n        Err(e) => return Err(e),\n    }\n}","preventionTips":["Size the resync timeout above the worst-case RTT of the link","Keep the buffered-message backlog small (fewer open projects/buffers) so resync is cheap","Repeated resync timeouts indicate link quality or a hung remote server, not a code bug"],"tags":["remote","reconnect","timeout","network","resync"],"backgroundTag":"operation-timed-out","analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}