{"record":{"id":"5c032aedd6f3551b","repo":"openai/codex","slug":"oauth-credential-store-pinned-concurrently-for-mcp","errorCode":null,"errorMessage":"OAuth credential store pinned concurrently for MCP server `{oauth_server_name}`","messagePattern":"OAuth credential store pinned concurrently for MCP server `(.+?)`","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/rmcp-client/src/rmcp_client.rs","lineNumber":1073,"sourceCode":"                            // initial construction below evaluates configured store policy.\n                            return store\n                                .load(&DefaultKeyringStore, &oauth_server_name, &oauth_url)\n                                .map(|tokens| tokens.map(|tokens| ResolvedOAuthTokens { tokens, store }));\n                        }\n\n                        match resolve_oauth_tokens_from_store_policy(\n                            &DefaultKeyringStore,\n                            &oauth_server_name,\n                            &oauth_url,\n                            oauth_store_mode,\n                            oauth_keyring_backend_kind,\n                        ) {\n                            Ok(tokens) => {\n                                if let Some(resolved) = tokens.as_ref() {\n                                    // Retries and session recovery rebuild this transport. Pin the\n                                    // first concrete source so Auto is not reevaluated mid-client.\n                                    pinned_credential_store.set(resolved.store).map_err(|_| {\n                                        anyhow!(\n                                            \"OAuth credential store pinned concurrently for MCP server `{oauth_server_name}`\"\n                                        )\n                                    })?;\n                                }\n                                Ok(tokens)\n                            }\n                            Err(err) => {\n                                warn!(\n                                    \"failed to read tokens for server `{oauth_server_name}`: {err}\"\n                                );\n                                Ok(None)\n                            }\n                        }\n                    })\n                    .await\n                    .map_err(|error| anyhow!(\"OAuth credential loading task failed: {error}\"))??\n                } else {\n                    None","sourceCodeStart":1055,"sourceCodeEnd":1091,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/rmcp-client/src/rmcp_client.rs#L1055-L1091","documentation":"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.","triggerScenarios":"Thrown at codex-rs/rmcp-client/src/rmcp_client.rs:1073 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}