BigPizzaV3/CodexPlusPlus · error
Codex app-server 请求超时
Error message
Codex app-server {method} 请求超时 What it means
The request() helper sends a JSON-RPC method to the Codex app-server and loops reading messages under the caller-supplied timeout (default REQUEST_TIMEOUT = 120s via initialize/prepare_thread). If the deadline expires before the matching response arrives, it throws this error naming the method, e.g. "Codex app-server initialize 请求超时".
Solutions
- Retry; check the app-server process is alive and inspect its stderr tail
- Ensure the Codex CLI is responsive on its own (run `codex --version`)
- Update the Codex CLI — an unresponsive/old app-server build is a common cause
- Increase timeouts at the call site if your environment legitimately needs more than 120s for initialize
Defensive patterns
Strategy: retry
Try / catch
let mut attempts = 0;
loop {
match CodexAppServer::start(config.clone()).await {
Ok(s) => break Ok(s),
Err(e) if e.to_string().contains("请求超时") && attempts < 1 => { attempts += 1; }
Err(e) => break Err(e),
}
} Prevention
- Smoke-test the CLI with --version before start
- Disable system sleep during initialize
- Update the CLI if initialize is routinely slow
- Keep request payloads (work_dir, options) simple and valid
When it happens
Trigger: Calling initialize or prepare_thread (both call request) when the app-server never answers within the timeout: server slow to start, deadlocked, crashed without closing the pipe, or flood of server requests being rejected one by one.
Common situations: Codex CLI first-run initialization taking very long, antivirus scanning the binary, app-server hung on startup, system under heavy load, CLI version that never responds to the sent method.
Understand the failure class
Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.
Related errors
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/cb0fdeee1292ca31.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/connect/app_server.rs:352
async fn request(
&mut self,
method: &str,
params: Value,
timeout: Duration,
) -> anyhow::Result<Value> {
let id = self.take_request_id();
self.write_json(&json!({
"jsonrpc": "2.0",
"id": id,
"method": method,
"params": params
}))
.await?;
let deadline = tokio::time::Instant::now() + timeout;
loop {
let remaining = deadline.saturating_duration_since(tokio::time::Instant::now());
if remaining.is_zero() {
bail!("Codex app-server {method} 请求超时");
}
let message = self.read_message(remaining).await?;
if is_server_request(&message) {
self.reject_server_request(&message).await?;
continue;
}
if response_id(&message) != Some(id) {
continue;
}
if let Some(error) = rpc_error(&message) {
bail!("Codex app-server {method} 失败:{error}");
}
return Ok(message.get("result").cloned().unwrap_or(Value::Null));
}
}
async fn read_message(&mut self, timeout: Duration) -> anyhow::Result<Value> {
loop {View on GitHub (pinned to b1ed92e5e4)