{"record":{"id":"784f5c4ed3e3b872","repo":"can1357/oh-my-pi","slug":"timed-out-waiting-for-rpc-ready-signal-stderr-s","errorCode":null,"errorMessage":"Timed out waiting for RPC ready signal. Stderr: {stderr}","messagePattern":"Timed out waiting for RPC ready signal\\. Stderr: (.+?)","errorType":"exception","errorClass":"RpcTimeoutError","httpStatus":null,"severity":"error","filePath":"python/omp-rpc/src/omp_rpc/client.py","lineNumber":630,"sourceCode":"            bufsize=1,\n            start_new_session=True,\n        )\n        self._process = process\n        self._pgid = _process_group_id(process)\n\n        self._stdout_thread = threading.Thread(\n            target=self._read_stdout_loop, name=\"omp-rpc-stdout\", daemon=True\n        )\n        self._stderr_thread = threading.Thread(\n            target=self._read_stderr_loop, name=\"omp-rpc-stderr\", daemon=True\n        )\n        self._stdout_thread.start()\n        self._stderr_thread.start()\n\n        if not self._ready.wait(self._startup_timeout):\n            stderr = self.stderr\n            self.stop()\n            raise RpcTimeoutError(\n                f\"Timed out waiting for RPC ready signal. Stderr: {stderr}\"\n            )\n\n        if not self._ready_received:\n            error = self._closed_error\n            stderr = self.stderr\n            self.stop()\n            if isinstance(error, RpcError):\n                raise error\n            if error is not None:\n                raise RpcProcessExitError(\n                    f\"RPC process stopped before ready: {error}. Stderr: {stderr}\"\n                ) from error\n            raise RpcTimeoutError(\n                f\"Timed out waiting for RPC ready signal. Stderr: {stderr}\"\n            )\n\n        ready_event = self._ready_event","sourceCodeStart":612,"sourceCodeEnd":648,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/python/omp-rpc/src/omp_rpc/client.py#L612-L648","documentation":"start() waits up to _startup_timeout for the agent subprocess to signal readiness on stdout. If the ready signal never arrives in time, the client stops the process and raises RpcTimeoutError including captured stderr to aid diagnosis.","triggerScenarios":"Agent binary slow to initialize (cold start, heavy imports), wrong command/path causing the process to hang or run a different program, ready signal lost due to stdout being consumed elsewhere, or startup_timeout too small for the environment.","commonSituations":"First-run model/native dependency downloads delaying startup; slow containers or CI machines; agent stuck prompting for input on stdin; wrong interpreter or missing module leaving the process blocked.","solutions":["Read the Stderr embedded in the error — it almost always names the real startup problem (import error, missing binary, auth prompt).","Increase the startup timeout option if the agent legitimately needs longer (slow disks, CI).","Verify the configured agent command runs correctly standalone and emits the ready frame.","Ensure nothing else drains the child's stdout and stdin is provided/closed as the protocol expects.","Pre-warm dependencies (model downloads, venvs) before starting the client in latency-sensitive paths."],"exampleFix":"# before\ndefault: short startup timeout on slow machine\nclient = RpcClient(command=..., startup_timeout=5)\n\n# after\nclient = RpcClient(command=..., startup_timeout=60)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    client.start()\nexcept RpcTimeoutError as exc:\n    logger.error(\"agent startup timed out; stderr=%s\", exc)\n    # retry with longer timeout or surface stderr to the user","preventionTips":["Set a startup_timeout appropriate for slow environments (CI, cold caches)","Verify the agent emits its ready frame promptly and flushes stdout","Pre-warm dependencies before starting the client","Always read the stderr included in the timeout error"],"tags":["rpc","timeout","startup","subprocess"],"backgroundTag":"startup-timeout","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}