{"record":{"id":"23c50e6ef8f36e4a","repo":"can1357/oh-my-pi","slug":"timed-out-waiting-for-response-to-command-type","errorCode":null,"errorMessage":"Timed out waiting for response to {command_type}. Stderr: {self.stderr}","messagePattern":"Timed out waiting for response to (.+?)\\. Stderr: (.+?)","errorType":"exception","errorClass":"RpcTimeoutError","httpStatus":null,"severity":"error","filePath":"python/omp-rpc/src/omp_rpc/client.py","lineNumber":1399,"sourceCode":"        response_queue: queue.Queue[JsonObject | BaseException] = queue.Queue(maxsize=1)\n        with self._state_lock:\n            self._pending[request_id] = _PendingRequest(\n                command=command_type, response_queue=response_queue\n            )\n\n        try:\n            self._write_json(process, envelope)\n        except BaseException:\n            with self._state_lock:\n                self._pending.pop(request_id, None)\n            raise\n\n        try:\n            response = response_queue.get(timeout=self._request_timeout)\n        except queue.Empty as exc:\n            with self._state_lock:\n                self._pending.pop(request_id, None)\n            raise RpcTimeoutError(\n                f\"Timed out waiting for response to {command_type}. Stderr: {self.stderr}\"\n            ) from exc\n\n        if isinstance(response, BaseException):\n            raise response\n\n        if not bool(response.get(\"success\", False)):\n            raw_code = response.get(\"code\")\n            raise RpcCommandError(\n                command=str(response.get(\"command\", command_type)),\n                error=str(response.get(\"error\", \"\")),\n                code=raw_code if isinstance(raw_code, str) else None,\n            )\n\n        data = response.get(\"data\")\n        if data is None:\n            return {}\n        return _clone_json_object(data)","sourceCodeStart":1381,"sourceCodeEnd":1417,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/python/omp-rpc/src/omp_rpc/client.py#L1381-L1417","documentation":"RpcTimeoutError raised by _request when no response for the given command_type arrives on the per-request response queue within self._request_timeout. The pending entry is removed and stderr is attached for diagnosis.","triggerScenarios":"Any synchronous RPC command (e.g. a request-style call) whose server-side handler takes longer than _request_timeout or never responds because the server is busy/hung/deadlocked.","commonSituations":"Slow commands (model listing, session load) on large sessions; server busy streaming a long prompt so request handling starves; request_timeout configured too low.","solutions":["Increase the client's request_timeout at construction","Avoid issuing synchronous commands while a prompt/stream is in flight; use async commands or wait for agent_end first","Check client.stderr and server state to see whether the handler crashed or is blocked","Retry the command after confirming the process is alive (catch RpcTimeoutError and re-issue)"],"exampleFix":"// before\nclient = make_client(request_timeout=10)\n// after\nclient = make_client(request_timeout=120)  # tolerate slow session/model commands","handlingStrategy":"retry","validationCode":"if client.poll() is not None:\n    raise RuntimeError(\"cannot send request; server process dead\")","typeGuard":null,"tryCatchPattern":"for attempt in range(2):\n    try:\n        return client._request(command_type, **payload)  # via public wrapper\n    except RpcTimeoutError as exc:\n        if attempt == 1:\n            raise\n        log.warning(\"request %s timed out, retrying\", command_type)","preventionTips":["Configure request_timeout above your slowest command's latency","Don't interleave sync requests with in-flight streaming prompts","Verify process liveness before sending commands"],"tags":["rpc","timeout","request-response","ipc"],"backgroundTag":"rpc-timeout","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}