openai/codex · error · anyhow::Error
required MCP servers failed to initialize
Error message
required MCP servers failed to initialize: {details} What it means
Session-init validation: one or more MCP servers marked required in config failed to initialize; details lists each server and its error. Session creation aborts because required capabilities are unavailable.
Solutions
- Fix each failing server per the per-server error in details
- Check server command/URL, env, and auth
- Mark the server optional in config if it is not truly required
- Retry after the servers recover
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at codex-rs/codex-mcp/src/connection_manager/required.rs:56 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/1d8ffec39b3f8ad3.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/codex-mcp/src/connection_manager/required.rs:56
}
failures
}
.instrument(info_span!(
"session_init.required_mcp_wait",
otel.name = "session_init.required_mcp_wait",
session_init.required_mcp_server_count = self.required_servers.len(),
))
.await;
if failures.is_empty() {
return Ok(());
}
let details = failures
.iter()
.map(|failure| format!("{}: {}", failure.server, failure.error))
.collect::<Vec<_>>()
.join("; ");
Err(anyhow!(
"required MCP servers failed to initialize: {details}"
))
}
}
fn startup_outcome_error_message(error: StartupOutcomeError) -> String {
match error {
StartupOutcomeError::Cancelled => "MCP startup cancelled".to_string(),
StartupOutcomeError::Failed { error, .. } => error,
}
}
View on GitHub (pinned to 339751715c)