{"record":{"id":"d814206d24d108c8","repo":"Kuberwastaken/claurst","slug":"lsp-request-timed-out-server","errorCode":null,"errorMessage":"LSP request '{}' timed out (server: {})","messagePattern":"LSP request '(.+?)' timed out \\(server: (.+?)\\)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-rust/crates/core/src/lsp.rs","lineNumber":318,"sourceCode":"        let body = serde_json::to_string(&msg)?;\r\n\r\n        let (tx, rx) = oneshot::channel();\r\n        self.pending.insert(id, tx);\r\n\r\n        {\r\n            let writer = self\r\n                .writer\r\n                .as_ref()\r\n                .ok_or_else(|| anyhow::anyhow!(\"LSP client already shut down\"))?;\r\n            let mut w = writer.lock().await;\r\n            send_message(&mut w, &body).await?;\r\n        }\r\n\r\n        let response =\r\n            tokio::time::timeout(std::time::Duration::from_secs(30), rx)\r\n                .await\r\n                .map_err(|_| {\r\n                    anyhow::anyhow!(\r\n                        \"LSP request '{}' timed out (server: {})\",\r\n                        method,\r\n                        self.server_name\r\n                    )\r\n                })?\r\n                .map_err(|_| {\r\n                    anyhow::anyhow!(\r\n                        \"LSP request '{}' channel closed (server: {})\",\r\n                        method,\r\n                        self.server_name\r\n                    )\r\n                })?;\r\n\r\n        if let Some(err) = response.get(\"error\") {\r\n            return Err(anyhow::anyhow!(\r\n                \"LSP error from {}: {}\",\r\n                self.server_name,\r\n                err\r","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/core/src/lsp.rs#L300-L336","documentation":"The LSP server did not answer a JSON-RPC request within the library's fixed 30-second timeout; the oneshot receiver registered in `pending` never resolved. The error names both the method and the server so you can tell which language server is unresponsive. The pending entry stays orphaned (its sender is dropped) but the client remains usable for later requests.","triggerScenarios":"Any request (initialize, hover, definition, references, document_symbols, shutdown) sent to a server that is busy indexing, hung, crashed mid-request (response channel closed is a different error, but a crashed-then-silent server can also look like this), or whose stdout pump exited so no dispatch ever happens.","commonSituations":"`initialize` timing out because the server was still starting on a cold cache (e.g. rust-analyzer first run on a large workspace); hover/definition timing out during heavy indexing; a dead server process whose output pipe produced nothing; extremely slow disk/network-mounted workspaces.","solutions":["Check whether the server process is alive (`ps aux | grep <server>`) and inspect its stderr logged at tracing::debug for crashes.","Give the server time to warm up: send initialize and wait for completion before other requests; retry the timed-out request.","Reduce indexing load (smaller workspace, exclude target/node_modules) or pre-warm the server's cache.","Restart the client (`LspClient::start`) if the server is wedged; if timeouts persist for a healthy server, patch the fixed 30s `Duration::from_secs(30)` in send_request_inner to a configurable value."],"exampleFix":"// before\nlet symbols = client.document_symbols(&uri).await?; // times out on cold server\n// after\nclient.initialize().await?; // let the server finish booting/indexing first\nlet symbols = tokio::time::timeout(Duration::from_secs(60), client.document_symbols(&uri)).await??;","handlingStrategy":"retry","validationCode":"// preflight: ensure the server responds to initialize before issuing time-sensitive requests\nlet client = LspClient::start(config.clone()).await?;\nclient.initialize().await.map_err(|e| anyhow::anyhow!(\"server {name} failed to initialize: {e}\"))?;","typeGuard":null,"tryCatchPattern":"match tokio::time::timeout(Duration::from_secs(45), client.hover(&uri, pos)).await {\n    Err(_) | Ok(Err(e)) if e.to_string().contains(\"timed out\") => {\n        warn!(\"LSP request timed out; retrying once\");\n        tokio::time::sleep(Duration::from_millis(500)).await;\n        client.hover(&uri, pos).await\n    }\n    Ok(r) => r,\n}","preventionTips":["Always complete initialize before other requests so the server is fully booted.","Pre-warm server caches or restrict workspace scope to keep indexing time down.","Wrap requests in your own outer timeout with one retry, and fall back gracefully (return None for hover/definition).","Monitor server liveness via its stderr (tracing::debug) and restart wedged clients."],"tags":["lsp","timeout","jsonrpc","rust"],"backgroundTag":"request-timeout","analyzedSha":"b0637c97ec34144387cbf2f74f65df6d16a6cef1","analyzedAt":"2026-09-10T00:24:58.650Z","contentChangedAt":"2026-09-10T00:24:58.650Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}