{"record":{"id":"643c20a8bb24a6bc","repo":"BigPizzaV3/CodexPlusPlus","slug":"codex-app-server","errorCode":null,"errorMessage":"Codex app-server 已关闭{}","messagePattern":"Codex app-server 已关闭(.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/connect/app_server.rs","lineNumber":300,"sourceCode":"            if response_id(&message) != Some(id) {\n                continue;\n            }\n            if let Some(error) = rpc_error(&message) {\n                bail!(\"Codex app-server {method} 失败：{error}\");\n            }\n            return Ok(message.get(\"result\").cloned().unwrap_or(Value::Null));\n        }\n    }\n\n    async fn read_message(&mut self, timeout: Duration) -> anyhow::Result<Value> {\n        loop {\n            let line = tokio::time::timeout(timeout, self.stdout.next_line())\n                .await\n                .context(\"等待 Codex app-server 响应超时\")??;\n            let Some(line) = line else {\n                self.running = false;\n                let exit = self.child.try_wait().ok().flatten();\n                bail!(\n                    \"Codex app-server 已关闭{}\",\n                    exit.map(|status| format!(\"：{status}\")).unwrap_or_default()\n                );\n            };\n            let line = line.trim();\n            if line.is_empty() {\n                continue;\n            }\n            match serde_json::from_str(line) {\n                Ok(message) => return Ok(message),\n                Err(_) => continue,\n            }\n        }\n    }\n\n    async fn reject_server_request(&mut self, message: &Value) -> anyhow::Result<()> {\n        let Some(id) = message.get(\"id\") else {\n            return Ok(());","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-core/src/connect/app_server.rs#L282-L318","documentation":"read_message got EOF on the app-server stdout: the child process is gone. The library marks the server not running and appends the child exit status, when it can still be reaped, to the message. Every pending run_turn or request call fails with this error once the process dies.","triggerScenarios":"The codex app-server crashed or exited: config.codex_path points at a binary that is not an app-server and exits immediately, codex is missing on PATH, the CLI is not logged in and exits, an OOM kill, or a manual kill.","commonSituations":"codex_path misconfigured in the profile; codex CLI updated and the old path removed; first run without login; system OOM during a big turn.","solutions":["Run the configured app-server command by hand and watch why it exits","Fix config.codex_path or install codex so the binary resolves on PATH","Complete codex login once interactively","The connector drops the server and restarts on the next message, after fixing the cause send another message to confirm"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"let exe = std::path::Path::new(&config.executable);\nif !exe.is_file() { bail!(\"codex executable missing: {}\", exe.display()); }\n// optional: run exe with --version once to prove it starts","typeGuard":null,"tryCatchPattern":"match server.run_turn(&thread_id, prompt).await {\n    Ok(r) => r,\n    Err(e) if e.to_string().contains(\"已关闭\") => {\n        let mut fresh = CodexAppServer::start(config.clone()).await?;\n        fresh.run_turn(&thread_id, prompt).await?\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Validate codex_path exists and is the app-server binary before starting","Complete codex login interactively once per machine","Watch child exit status in the message to distinguish crash from clean exit"],"tags":["process","codex","app-server","eof","crash"],"backgroundTag":"subprocess-exited-unexpectedly","analyzedSha":"f2074595a281bc057525c748175c8eb9805b0673","analyzedAt":"2026-08-23T12:52:24.489Z","contentChangedAt":"2026-08-23T12:52:24.489Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}