oraios/serena · error · TimeoutError
Request timed out ({timeout=})
Error message
Request timed out ({timeout=}) What it means
TimeoutError raised by LSPProcess.get_result when the result queue yields nothing within the given timeout. _send_request_once sends a request to the language-server subprocess and waits on a multiprocessing queue; if the server process never responds in time, the Empty queue exception is converted into this TimeoutError with the timeout value embedded.
Source
Thrown at src/solidlsp/ls_process.py:107
def on_result(self, params: PayloadLike) -> None:
self._status = "completed"
self._result_queue.put(Request.Result(payload=params))
def on_error(self, err: Exception) -> None:
"""
:param err: the error that occurred while processing the request (typically an LSPError
for errors returned by the LS or LanguageServerTerminatedException if the error
is due to the language server process terminating unexpectedly).
"""
self._status = "error"
self._result_queue.put(Request.Result(error=err))
def get_result(self, timeout: float | None = None) -> Result:
try:
return self._result_queue.get(timeout=timeout)
except Empty as e:
if timeout is not None:
raise TimeoutError(f"Request timed out ({timeout=})") from e
raise e
class LanguageServerInterface(ABC):
"""
Represents an interface to a language server, providing methods for communicating with it using the
Language Server Protocol (LSP).
It provides methods for sending requests, responses, and notifications to the server
and for registering handlers for requests and notifications from the server.
Uses JSON-RPC 2.0 for communication with the server over stdin/stdout.
"""
def __init__(
self,
ls_id: LanguageServerId,
determine_log_level: Callable[[str], int],View on GitHub (pinned to 7fcbca7e62)
Solutions
- Retry with a larger timeout (or None) for slow servers / first-request indexing.
- Check whether the LSP subprocess is alive; if it crashed or hung, restart the SolidLanguageServer instance.
- Reduce workload: request symbols for smaller scopes/files, or warm up the server with a cheap request before time-sensitive calls.
- Capture the language server's stderr/log output to identify a hang or crash in the underlying LSP binary.
Example fix
// before
result = ls.request_document_symbols("huge/generated.ts", timeout=1.0)
// after
try:
result = ls.request_document_symbols("huge/generated.ts", timeout=1.0)
except TimeoutError:
result = ls.request_document_symbols("huge/generated.ts", timeout=60.0) Defensive patterns
Strategy: retry
Validate before calling
import psutil
proc = getattr(ls, "_lsp_process", None)
if proc is not None and not proc.is_alive():
raise RuntimeError("LSP subprocess dead; restart the server before issuing requests") Try / catch
try:
result = call_api(..., timeout=timeout_s)
except TimeoutError:
result = call_api(..., timeout=timeout_s * 4) # retry with backoff and larger timeout Prevention
- Use generous timeouts (or none) for first requests on large projects
- Warm up the server with a small request after startup
- Monitor LSP subprocess liveness and stderr for hangs/crashes
- Restart the SolidLanguageServer instance after a timeout instead of reusing a possibly wedged process
When it happens
Trigger: Calling any request API with a timeout shorter than the server's response time (huge files, cold-start indexing), a hung/crashed LSP subprocess, or requests sent to a server busy with a long operation (e.g. initial project indexing).
Common situations: Large monorepos where the first request times out during startup indexing, language-server binary hanging (known issues with some LSPs on big files), system resource starvation slowing the subprocess, or a dead subprocess after a crash so no result ever arrives.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Unhandled document change kind: {change}; Please report to S
- Unhandled document change format: {change}; Please report to
- Symbol '{name_path}' does not have a valid position in file
- Language server for {lang_server.language_id} returned no re
- Renaming symbol '{name_path}' to '{new_name}' resulted in no
AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29).
Data as JSON: /api/errors/0b9bb5583d3cdbe4.
Report an issue: GitHub.