openai/codex · error · anyhow::Error
MCP client not initialized
Error message
MCP client not initialized
What it means
Error "MCP client not initialized" thrown in openai/codex.
Source
Thrown at codex-rs/rmcp-client/src/rmcp_client.rs:928
let handle = service
.peer()
.send_cancellable_request(
ClientRequest::CustomRequest(request),
rmcp::service::PeerRequestOptions::no_options(),
)
.await?;
Ok(CancellableEventStreamRequest {
handle,
notifications,
})
}
async fn service(&self) -> Result<Arc<RunningService<RoleClient, ElicitationClientService>>> {
let guard = self.state.lock().await;
match &*guard {
ClientState::Ready { service, .. } => Ok(Arc::clone(service)),
ClientState::Connecting { .. } => Err(anyhow!("MCP client not initialized")),
ClientState::Closed => Err(anyhow!("MCP client is shut down")),
}
}
async fn oauth_persistor(&self) -> Option<OAuthPersistor> {
let guard = self.state.lock().await;
match &*guard {
ClientState::Ready {
oauth: Some(runtime),
..
} => Some(runtime.clone()),
_ => None,
}
}
/// Returns `None` when this client does not manage stored OAuth credentials.
pub async fn managed_oauth_credentials(&self) -> Option<Option<StoredOAuthTokens>> {
let persistor = self.oauth_persistor().await?;View on GitHub (pinned to 339751715c)
When it happens
Trigger: Thrown at codex-rs/rmcp-client/src/rmcp_client.rs:928 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/b6609234417f72a8.
Report an issue: GitHub.