{"record":{"id":"90b5b75ef6812680","repo":"BigPizzaV3/CodexPlusPlus","slug":"app-server-codex-wechat","errorCode":null,"errorMessage":"app-server 未启动","messagePattern":"app-server 未启动","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"tools/codex-wechat/codex_wechat.py","lineNumber":435,"sourceCode":"            errors=\"replace\",\n            bufsize=1,\n        )\n        assert self.proc.stdout is not None\n        assert self.proc.stderr is not None\n        threading.Thread(target=self._reader, args=(self.proc.stdout, \"stdout\"), daemon=True).start()\n        threading.Thread(target=self._reader, args=(self.proc.stderr, \"stderr\"), daemon=True).start()\n        self._request(\n            \"initialize\",\n            {\n                \"clientInfo\": {\"name\": \"codex-wechat\", \"version\": \"0.1.0\"},\n                \"capabilities\": None,\n            },\n            timeout=20,\n        )\n\n    def _send(self, message: dict[str, Any]) -> None:\n        if not self.proc or not self.proc.stdin:\n            raise RuntimeError(\"app-server 未启动\")\n        self.proc.stdin.write(json.dumps(message, ensure_ascii=False) + \"\\n\")\n        self.proc.stdin.flush()\n\n    def _request(self, method: str, params: Any, timeout: int | None = None) -> dict[str, Any]:\n        req_id = self.next_id\n        self.next_id += 1\n        self._send({\"id\": req_id, \"method\": method, \"params\": params})\n\n        deadline = time.time() + (timeout or self.cfg.codex.timeout_seconds)\n        while time.time() < deadline:\n            try:\n                msg = self.messages.get(timeout=0.5)\n            except queue.Empty:\n                if self.proc and self.proc.poll() is not None:\n                    raise RuntimeError(f\"app-server 已退出，退出码 {self.proc.returncode}\")\n                continue\n            if msg.get(\"id\") == req_id:\n                if \"error\" in msg:","sourceCodeStart":417,"sourceCodeEnd":453,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/tools/codex-wechat/codex_wechat.py#L417-L453","documentation":"Raised by the app-server client's _send when it tries to write a JSON-RPC message but self.proc or self.proc.stdin is None. It is a sentinel state error meaning the codex app-server subprocess was never spawned (or its stdin pipe is gone), so any request like initialize would be silently lost.","triggerScenarios":"Thrown at tools/codex-wechat/codex_wechat.py:435 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the app-server process is started before sending requests; check that codex is installed and the configured command/args are correct.","Call the client's start/initialize path (e.g. _start) before issuing any RPC and restart the client on failure.","Log self.proc state to confirm whether the process spawn failed or the pipe was closed after exit."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}