BigPizzaV3/CodexPlusPlus · error · anyhow::Error

Codex app-server {method} 请求超时

Error message

Codex app-server {method} 请求超时

What it means

request() is the generic JSON-RPC call used for initialize and thread/start or thread/resume, each bounded by REQUEST_TIMEOUT. This error fires when no response with the matching request id arrives before the deadline; server-request notifications are rejected and skipped and unrelated ids ignored, so only a missing or late answer triggers it.

Source

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

    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 f2074595a2)

Solutions

  1. Run codex once manually so first-run setup completes outside the connector
  2. Complete codex login before starting the connector
  3. Retry the connect after the app-server settles; pre-warm it on boot if this recurs
  4. If it reproduces reliably, capture app-server stderr and raise REQUEST_TIMEOUT locally as a stopgap
Defensive patterns

Strategy: retry

Try / catch

let result = match server.request(method, params, REQUEST_TIMEOUT).await {
    Ok(v) => v,
    Err(e) if e.to_string().contains("请求超时") => {
        tokio::time::sleep(Duration::from_secs(2)).await;
        server.request(method, params, REQUEST_TIMEOUT).await?
    }
    Err(e) => return Err(e),
};

Prevention

When it happens

Trigger: initialize on a cold codex app-server that boots slowly (first-run migrations, slow disk); thread/resume against a large archived thread; the app-server is alive but stuck, for example waiting on auth.

Common situations: First launch after install or upgrade; HOME on network storage; codex not logged in so the app-server stalls; underpowered machine under load.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@f2074595a2 (2026-08-23). Data as JSON: /api/errors/cb0fdeee1292ca31. Report an issue: GitHub.