openai/codex · error · anyhow::Error
OAuth credential store pinned concurrently for MCP server
Error message
OAuth credential store pinned concurrently for MCP server `{oauth_server_name}` What it means
Concurrency guard during OAuth token loading: two tasks tried to pin the credential store for the same MCP server simultaneously and the second set() on the pinned cell failed. Indicates a race where token loading was started twice for one client rather than a bad stored credential.
Solutions
- Ensure OAuth credential loading is started once per client/server rather than concurrently
- Retry the operation; the winner of the race has already pinned a valid store
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at codex-rs/rmcp-client/src/rmcp_client.rs:1073 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/5c032aedd6f3551b.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/rmcp-client/src/rmcp_client.rs:1073
// initial construction below evaluates configured store policy.
return store
.load(&DefaultKeyringStore, &oauth_server_name, &oauth_url)
.map(|tokens| tokens.map(|tokens| ResolvedOAuthTokens { tokens, store }));
}
match resolve_oauth_tokens_from_store_policy(
&DefaultKeyringStore,
&oauth_server_name,
&oauth_url,
oauth_store_mode,
oauth_keyring_backend_kind,
) {
Ok(tokens) => {
if let Some(resolved) = tokens.as_ref() {
// Retries and session recovery rebuild this transport. Pin the
// first concrete source so Auto is not reevaluated mid-client.
pinned_credential_store.set(resolved.store).map_err(|_| {
anyhow!(
"OAuth credential store pinned concurrently for MCP server `{oauth_server_name}`"
)
})?;
}
Ok(tokens)
}
Err(err) => {
warn!(
"failed to read tokens for server `{oauth_server_name}`: {err}"
);
Ok(None)
}
}
})
.await
.map_err(|error| anyhow!("OAuth credential loading task failed: {error}"))??
} else {
NoneView on GitHub (pinned to 339751715c)