openai/codex · error · anyhow::Error

unsupported --listen URL

Error message

unsupported --listen URL `{listen_url}`; expected `ws://IP:PORT`, `grpc://IP:PORT`, `stdio`, or `stdio://`

What it means

Returned by the code-mode-host listen URL parser when the --listen value is none of ws://IP:PORT, grpc://IP:PORT, stdio, or stdio://. (Malformed addresses within a recognized scheme are reported by the scheme-specific parse errors instead.)

Solutions

  1. Use one of the documented --listen forms
  2. Fix the scheme or address syntax (e.g. ws://127.0.0.1:8080)
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    if let Some(socket_addr) = listen_url.strip_prefix("ws://") {
        return socket_addr
            .parse::<SocketAddr>()
            .map(ListenTransport::WebSocket)
            .with_context(|| {
                format!("invalid websocket --listen URL `{listen_url}`; expected `ws://IP:PORT`")
            });
    }

    if let Some(socket_addr) = listen_url.strip_prefix("grpc://") {
        return socket_addr
            .parse::<SocketAddr>()
            .map(ListenTransport::Grpc)
            .with_context(|| {
                format!("invalid gRPC --listen URL `{listen_url}`; expected `grpc://IP:PORT`")
            });
    }

    anyhow::bail!(
        "unsupported --listen URL `{listen_url}`; expected `ws://IP:PORT`, `grpc://IP:PORT`, `stdio`, or `stdio://`"
    );
}

async fn bind_websocket_listener(
    bind_address: SocketAddr,
) -> Result<TapIo<TcpListener, impl FnMut(&mut TcpStream) + Send + 'static>> {
    let listener = TcpListener::bind(bind_address)
        .await
        .with_context(|| format!("failed to bind code-mode host websocket to {bind_address}"))?;

    Ok(listener.tap_io(|stream| {
        if let Err(error) = stream.set_nodelay(/*nodelay*/ true) {
            warn!(%error, "failed to enable TCP_NODELAY for code-mode host connection");
        }
    }))
}

View on GitHub (pinned to 339751715c)