{"record":{"id":"7c031741d7ab33c8","repo":"BigPizzaV3/CodexPlusPlus","slug":"error-7c0317","errorCode":null,"errorMessage":"{error}","messagePattern":"\\{error\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/connect/app_server.rs","lineNumber":269,"sourceCode":"                usage = reported_usage;\n            }\n\n            match message.get(\"method\").and_then(Value::as_str) {\n                Some(\"item/completed\") => {\n                    if let Some(text) = extract_completed_agent_text(&message) {\n                        if !reply_parts.iter().any(|part| part == &text) {\n                            reply_parts.push(text);\n                        }\n                    }\n                }\n                Some(\"turn/completed\") => turn_completed = true,\n                Some(\"thread/status/changed\") if thread_status_is_idle(&message) => {\n                    turn_completed = true;\n                }\n                Some(\"error\") => {\n                    let error = deep_string(message.get(\"params\"), &[\"message\", \"error\"])\n                        .unwrap_or_else(|| \"Codex app-server 返回未知错误\".to_string());\n                    bail!(\"{error}\");\n                }\n                _ => {}\n            }\n        }\n        Ok(AppServerTurnResult {\n            reply: reply_parts.join(\"\\n\\n\"),\n            model,\n            usage,\n        })\n    }\n\n    pub async fn close(&mut self) {\n        self.running = false;\n        let _ = self.stdin.shutdown().await;\n        let _ = self.child.start_kill();\n        let _ = self.child.wait().await;\n    }\n","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/connect/app_server.rs#L251-L287","documentation":"While streaming turn events, run_turn matches a notification with method \"error\" and bails with the message taken from params.message/params.error (deep_string lookup), falling back to a generic unknown-error string. This is Codex reporting a runtime failure during the turn — the library faithfully rethrows the server's text.","triggerScenarios":"run_turn's event loop receives a JSON-RPC notification with method \"error\" mid-turn: model runtime failure, context/tool execution error inside Codex, sandbox denial, internal Codex panic reported as an error event.","commonSituations":"Command executed by Codex failed fatally (e.g. sandbox blocked a required syscall), model provider outage mid-turn, context overflow errors surfaced by newer CLIs as error events, corrupted session state in CODEX_HOME.","solutions":["Read the {error} text — it is Codex's own message and identifies the runtime cause","Retry the turn; transient provider issues often resolve on retry","If it mentions sandbox/permissions, adjust the sandbox setting or work_dir","Clear corrupted session state or update the Codex CLI if the message points at an internal bug"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match server.run_turn(prompt).await {\n    Err(e) => {\n        let msg = e.to_string();\n        if !msg.contains(\"超时\") && !msg.contains(\"路径\") && !msg.contains(\"turn/start\") {\n            eprintln!(\"Codex reported: {msg}\");\n            // retry once for transient provider errors, else surface\n        }\n    }\n    Ok(r) => { /* use r.reply */ }\n}","preventionTips":["Retry transient errors; surface persistent ones","Pre-approve commands Codex needs so sandbox doesn't kill turns","Keep CLI updated for clearer error events","Avoid reusing corrupted session state"],"tags":["json-rpc","runtime","ipc","error-event"],"backgroundTag":"upstream-api-error","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"}