can1357/oh-my-pi · error · RpcTimeoutError

Timed out waiting for response to {command_type}. Stderr: {s

Error message

Timed out waiting for response to {command_type}. Stderr: {self.stderr}

What it means

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.

Source

Thrown at python/omp-rpc/src/omp_rpc/client.py:1399

        response_queue: queue.Queue[JsonObject | BaseException] = queue.Queue(maxsize=1)
        with self._state_lock:
            self._pending[request_id] = _PendingRequest(
                command=command_type, response_queue=response_queue
            )

        try:
            self._write_json(process, envelope)
        except BaseException:
            with self._state_lock:
                self._pending.pop(request_id, None)
            raise

        try:
            response = response_queue.get(timeout=self._request_timeout)
        except queue.Empty as exc:
            with self._state_lock:
                self._pending.pop(request_id, None)
            raise RpcTimeoutError(
                f"Timed out waiting for response to {command_type}. Stderr: {self.stderr}"
            ) from exc

        if isinstance(response, BaseException):
            raise response

        if not bool(response.get("success", False)):
            raw_code = response.get("code")
            raise RpcCommandError(
                command=str(response.get("command", command_type)),
                error=str(response.get("error", "")),
                code=raw_code if isinstance(raw_code, str) else None,
            )

        data = response.get("data")
        if data is None:
            return {}
        return _clone_json_object(data)

View on GitHub (pinned to 9690622007)

Solutions

  1. Increase the client's request_timeout at construction
  2. Avoid issuing synchronous commands while a prompt/stream is in flight; use async commands or wait for agent_end first
  3. Check client.stderr and server state to see whether the handler crashed or is blocked
  4. Retry the command after confirming the process is alive (catch RpcTimeoutError and re-issue)

Example fix

// before
client = make_client(request_timeout=10)
// after
client = make_client(request_timeout=120)  # tolerate slow session/model commands
Defensive patterns

Strategy: retry

Validate before calling

if client.poll() is not None:
    raise RuntimeError("cannot send request; server process dead")

Try / catch

for attempt in range(2):
    try:
        return client._request(command_type, **payload)  # via public wrapper
    except RpcTimeoutError as exc:
        if attempt == 1:
            raise
        log.warning("request %s timed out, retrying", command_type)

Prevention

When it happens

Trigger: 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.

Common situations: Slow commands (model listing, session load) on large sessions; server busy streaming a long prompt so request handling starves; request_timeout configured too low.

Understand the failure class

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/23c50e6ef8f36e4a. Report an issue: GitHub.