openai/codex · error · anyhow::Error
timed out handshaking with MCP server after {duration:?}
Error message
timed out handshaking with MCP server after {duration:?} What it means
Error "timed out handshaking with MCP server after {duration:?}" thrown in openai/codex.
Source
Thrown at codex-rs/rmcp-client/src/streamable_http_retry.rs:99
.connect_pending_transport(transport, client_service.clone(), attempt_timeout)
.await
{
Ok(result) => return Ok(result),
Err(error) if should_retry && Self::is_retryable_initialize_error(&error) => {
let Some(retry_delay_ms) = retry_delay_ms else {
return Err(error);
};
let delay = Duration::from_millis(retry_delay_ms);
warn!(
attempt = attempt + 1,
max_attempts = STREAMABLE_HTTP_RETRY_DELAYS_MS.len() + 1,
delay_ms = delay.as_millis(),
error = %error,
"streamable HTTP MCP initialize failed with a retryable error; retrying"
);
if !sleep_with_retry_deadline(delay, retry_deadline).await {
let duration = timeout.unwrap_or(delay);
return Err(anyhow!(
"timed out handshaking with MCP server after {duration:?}"
));
}
}
Err(error) => return Err(error),
}
}
unreachable!("initialize retry loop should return on success or final error")
}
fn is_retryable_initialize_error(error: &anyhow::Error) -> bool {
error.chain().any(|source| {
source
.downcast_ref::<HandshakeError>()
.is_some_and(|error| Self::is_retryable_client_initialize_error(&error.source))
|| source
.downcast_ref::<rmcp::service::ClientInitializeError>()View on GitHub (pinned to 339751715c)
When it happens
Trigger: Thrown at codex-rs/rmcp-client/src/streamable_http_retry.rs:99 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/bb1be6074b020d30.
Report an issue: GitHub.