openai/codex · error · io::Error

code-mode websocket messages must be binary framed messages

Error message

code-mode websocket messages must be binary framed messages

What it means

Error "code-mode websocket messages must be binary framed messages" thrown in openai/codex.

Source

Thrown at codex-rs/code-mode-host/src/transport.rs:160

impl ConnectionReader {
    pub(crate) fn from_reader<R>(reader: R) -> Self
    where
        R: AsyncRead + Send + Unpin + 'static,
    {
        Self::Framed(FramedReader::new(Box::new(reader)))
    }

    pub(crate) async fn read(&mut self) -> io::Result<Option<ClientToHost>> {
        match self {
            Self::Framed(reader) => reader.read().await,
            Self::WebSocket(reader) => loop {
                match reader.next().await {
                    Some(Ok(Message::Binary(bytes))) => {
                        return EncodedFrame::decode_framed(&bytes).map(Some);
                    }
                    Some(Ok(Message::Text(_))) => {
                        return Err(io::Error::new(
                            io::ErrorKind::InvalidData,
                            "code-mode websocket messages must be binary framed messages",
                        ));
                    }
                    Some(Ok(Message::Ping(_) | Message::Pong(_))) => {}
                    Some(Ok(Message::Close(_))) | None => return Ok(None),
                    Some(Err(err)) => {
                        return Err(io::Error::other(format!(
                            "failed to read code-mode websocket message: {err}"
                        )));
                    }
                }
            },
        }
    }
}

impl ConnectionWriter {

View on GitHub (pinned to 339751715c)

When it happens

Trigger: Thrown at codex-rs/code-mode-host/src/transport.rs:160 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/f0568010b82af10e. Report an issue: GitHub.