openai/codex · error · anyhow::Error

runner pipe closed before spawn_ready

Error message

runner pipe closed before spawn_ready

What it means

Sentinel error from read_spawn_ready: wait_for_complete_frame/wait on the runner pipe returned EOF (read_frame yielded None) before the runner sent its spawn_ready acknowledgment. The runner process died or closed its IPC pipe during startup, so the spawn handshake cannot complete.

Solutions

  1. Check the runner process logs/crash reason — it exited before signaling readiness
  2. Verify the runner binary path and arguments are valid so it can start successfully
  3. Retry the spawn; transient runner startup crashes (for example DLL or policy issues) may clear after fixing the environment
  4. Confirm the pipe is not being closed early by handle inheritance or sandbox policy issues
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at codex-rs/windows-sandbox-rs/src/elevated/runner_client.rs:162 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at codex-rs/windows-sandbox-rs/src/elevated/runner_client.rs:162

        Err(err) => Err(err),
    }
}

impl RunnerTransport {
    pub(crate) fn send_spawn_request(&mut self, request: SpawnRequest) -> Result<()> {
        let spawn_request = FramedMessage {
            version: IPC_PROTOCOL_VERSION,
            message: Message::SpawnRequest {
                payload: Box::new(request),
            },
        };
        write_frame(&mut self.pipe_write, &spawn_request)
    }

    pub(crate) fn read_spawn_ready(&mut self) -> Result<()> {
        wait_for_complete_frame(&self.pipe_read, RUNNER_SPAWN_READY_TIMEOUT)?;
        let msg = read_frame(&mut self.pipe_read)?
            .ok_or_else(|| anyhow::anyhow!("runner pipe closed before spawn_ready"))?;
        match msg.message {
            Message::SpawnReady { .. } => Ok(()),
            Message::Error { payload } => Err(RunnerStartupError::new(payload).into()),
            other => Err(anyhow::anyhow!(
                "expected spawn_ready from runner, got {other:?}"
            )),
        }
    }

    pub(crate) fn into_files(self) -> (File, File) {
        (self.pipe_write, self.pipe_read)
    }
}

fn try_take_completed_connect_result(
    connect_thread: &mut Option<thread::JoinHandle<()>>,
    connect_result_rx: &mpsc::Receiver<Result<()>>,
    thread_handle: HANDLE,

View on GitHub (pinned to 339751715c)