BigPizzaV3/CodexPlusPlus · error

{error}

Error message

{error}

What it means

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.

Solutions

  1. Read the {error} text — it is Codex's own message and identifies the runtime cause
  2. Retry the turn; transient provider issues often resolve on retry
  3. If it mentions sandbox/permissions, adjust the sandbox setting or work_dir
  4. Clear corrupted session state or update the Codex CLI if the message points at an internal bug
Defensive patterns

Strategy: try-catch

Try / catch

match server.run_turn(prompt).await {
    Err(e) => {
        let msg = e.to_string();
        if !msg.contains("超时") && !msg.contains("路径") && !msg.contains("turn/start") {
            eprintln!("Codex reported: {msg}");
            // retry once for transient provider errors, else surface
        }
    }
    Ok(r) => { /* use r.reply */ }
}

Prevention

When it happens

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

Common situations: 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.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/7c031741d7ab33c8. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/connect/app_server.rs:269

                usage = reported_usage;
            }

            match message.get("method").and_then(Value::as_str) {
                Some("item/completed") => {
                    if let Some(text) = extract_completed_agent_text(&message) {
                        if !reply_parts.iter().any(|part| part == &text) {
                            reply_parts.push(text);
                        }
                    }
                }
                Some("turn/completed") => turn_completed = true,
                Some("thread/status/changed") if thread_status_is_idle(&message) => {
                    turn_completed = true;
                }
                Some("error") => {
                    let error = deep_string(message.get("params"), &["message", "error"])
                        .unwrap_or_else(|| "Codex app-server 返回未知错误".to_string());
                    bail!("{error}");
                }
                _ => {}
            }
        }
        Ok(AppServerTurnResult {
            reply: reply_parts.join("\n\n"),
            model,
            usage,
        })
    }

    pub async fn close(&mut self) {
        self.running = false;
        let _ = self.stdin.shutdown().await;
        let _ = self.child.start_kill();
        let _ = self.child.wait().await;
    }

View on GitHub (pinned to b1ed92e5e4)