openai/codex · error · anyhow::Error

timed out waiting for pid-managed app server {pid} to stop

Error message

timed out waiting for pid-managed app server {pid} to stop

What it means

Error "timed out waiting for pid-managed app server {pid} to stop" thrown in openai/codex.

Source

Thrown at codex-rs/app-server-daemon/src/backend/pid.rs:282

                }
                if !self.record_is_active(&record).await? {
                    match self.refresh_after_stale_record(&record).await? {
                        PidFileState::Missing => return Ok(()),
                        PidFileState::Starting | PidFileState::Running(_) => break,
                    }
                }
                if tokio::time::Instant::now() >= deadline {
                    break;
                }
                if !forced && started_at.elapsed() >= STOP_GRACE_PERIOD {
                    self.force_terminate_process(pid)?;
                    forced = true;
                }
                sleep(STOP_POLL_INTERVAL).await;
            }

            if self.record_is_active(&record).await? {
                bail!("timed out waiting for pid-managed app server {pid} to stop");
            }
        }
    }

    async fn wait_for_pid_start(&self) -> Result<Option<PidRecord>> {
        let deadline = tokio::time::Instant::now() + START_TIMEOUT;
        loop {
            match self.read_pid_file_state().await? {
                PidFileState::Missing => return Ok(None),
                PidFileState::Running(record) => return Ok(Some(record)),
                PidFileState::Starting if tokio::time::Instant::now() < deadline => {
                    sleep(STOP_POLL_INTERVAL).await;
                }
                PidFileState::Starting => {
                    bail!(
                        "timed out waiting for pid reservation in {} to finish initializing",
                        self.pid_file.display()
                    );

View on GitHub (pinned to 339751715c)

When it happens

Trigger: Thrown at codex-rs/app-server-daemon/src/backend/pid.rs:282 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/749ea179d28141b7. Report an issue: GitHub.