openai/codex · error · std::io::Error

socket closed while sending frame payload

Error message

socket closed while sending frame payload

What it means

Error "socket closed while sending frame payload" thrown in openai/codex.

Source

Thrown at codex-rs/shell-escalation/src/unix/socket.rs:335

}

async fn send_stream_frame(
    socket: &AsyncFd<Socket>,
    frame: &[u8],
    fds: &[OwnedFd],
) -> std::io::Result<()> {
    let mut written = 0;
    let mut include_fds = !fds.is_empty();
    while written < frame.len() {
        let mut guard = socket.writable().await?;
        let bytes_written = match guard
            .try_io(|inner| send_stream_chunk(inner.get_ref(), &frame[written..], fds, include_fds))
        {
            Ok(result) => result?,
            Err(_would_block) => continue,
        };
        if bytes_written == 0 {
            return Err(std::io::Error::new(
                std::io::ErrorKind::WriteZero,
                "socket closed while sending frame payload",
            ));
        }
        written += bytes_written;
        include_fds = false;
    }
    Ok(())
}

fn send_stream_chunk(
    socket: &Socket,
    frame: &[u8],
    fds: &[OwnedFd],
    include_fds: bool,
) -> std::io::Result<usize> {
    let control = if include_fds {
        make_control_message(fds)?

View on GitHub (pinned to 339751715c)

When it happens

Trigger: Thrown at codex-rs/shell-escalation/src/unix/socket.rs:335 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/4b9db635c1e6474f. Report an issue: GitHub.