openai/codex · error · anyhow::Error

handshake succeeded but server info was missing

Error message

handshake succeeded but server info was missing

What it means

Post-handshake consistency check in initialize: the MCP initialize handshake completed but the server's initialize result omitted peer info (server name/version), which the client requires to build ServerPeerInfo. The server's InitializeResult is the input at fault for being incomplete.

Solutions

  1. Fix the MCP server to populate serverInfo in its initialize result
  2. Upgrade or patch the server implementation so the lifecycle handshake returns complete peer metadata
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/rmcp-client/src/rmcp_client.rs:618 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/6cc86645ef12bc51. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/rmcp-client/src/rmcp_client.rs:618

                    None => return Err(anyhow!("client already initializing")),
                },
                ClientState::Ready { .. } => return Err(anyhow!("client already initialized")),
                ClientState::Closed => return Err(anyhow!("MCP client is shut down")),
            }
        };

        let (service, oauth_persistor) = self
            .connect_pending_transport_with_initialize_retries(
                pending_transport,
                client_service.clone(),
                timeout,
            )
            .await?;

        let initialize_result_rmcp = service
            .peer()
            .peer_info()
            .ok_or_else(|| anyhow!("handshake succeeded but server info was missing"))?;
        let initialize_result = initialize_result_rmcp.as_ref().clone();

        {
            let mut initialize_context = self.initialize_context.lock().await;
            *initialize_context = Some(InitializeContext {
                timeout,
                client_service,
            });
        }

        {
            let mut guard = self.state.lock().await;
            if matches!(*guard, ClientState::Closed) {
                return Err(anyhow!("MCP client is shut down"));
            }
            *guard = ClientState::Ready {
                service,
                oauth: oauth_persistor.clone(),

View on GitHub (pinned to 339751715c)