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

failed to decode code-mode IPC frame

Error message

failed to decode code-mode IPC frame: {err}

What it means

decode_framed: the payload bytes were present and correctly sized but serde_json failed to deserialize them into the target message type, meaning the JSON does not match the expected schema (likely a protocol version mismatch).

Solutions

  1. Align client and host protocol versions
  2. Inspect {err} for the exact field mismatch
  3. Reconnect with a compatible peer
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/code-mode-protocol/src/host/codec.rs:85 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/183478c350034167. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/code-mode-protocol/src/host/codec.rs:85

            return Err(io::Error::new(
                io::ErrorKind::InvalidData,
                format!("code-mode IPC frame length {length} exceeds {MAX_FRAME_BYTES} bytes"),
            ));
        }

        let payload = &bytes[size_of::<u32>()..];
        if payload.len() != length {
            return Err(io::Error::new(
                io::ErrorKind::InvalidData,
                format!(
                    "code-mode IPC frame declares {length} payload bytes but contains {}",
                    payload.len()
                ),
            ));
        }

        serde_json::from_slice(payload).map_err(|err| {
            io::Error::new(
                io::ErrorKind::InvalidData,
                format!("failed to decode code-mode IPC frame: {err}"),
            )
        })
    }
}

/// Decodes JSON messages prefixed by a four-byte little-endian payload length.
pub struct FramedReader<R> {
    reader: R,
}

impl<R> FramedReader<R>
where
    R: AsyncRead + Unpin,
{
    pub fn new(reader: R) -> Self {
        Self { reader }

View on GitHub (pinned to 339751715c)