{"record":{"id":"7f6faf6a71aa82b4","repo":"openai/codex","slug":"mcp-client-recovery-semaphore-closed","errorCode":null,"errorMessage":"MCP client recovery semaphore closed","messagePattern":"MCP client recovery semaphore closed","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/rmcp-client/src/rmcp_client.rs","lineNumber":1430,"sourceCode":"            .is_some_and(|error| {\n                matches!(\n                    error,\n                    StreamableHttpError::Client(\n                        StreamableHttpClientAdapterError::SessionExpired404\n                    )\n                )\n            })\n    }\n\n    async fn reinitialize_after_session_expiry(\n        &self,\n        failed_service: &Arc<RunningService<RoleClient, ElicitationClientService>>,\n    ) -> Result<()> {\n        let _recovery_guard = self\n            .session_recovery_lock\n            .acquire()\n            .await\n            .map_err(|_| anyhow!(\"MCP client recovery semaphore closed\"))?;\n\n        {\n            let guard = self.state.lock().await;\n            match &*guard {\n                ClientState::Ready { service, .. } if !Arc::ptr_eq(service, failed_service) => {\n                    return Ok(());\n                }\n                ClientState::Ready { .. } => {}\n                ClientState::Connecting { .. } => {\n                    return Err(anyhow!(\"MCP client not initialized\"));\n                }\n                ClientState::Closed => {\n                    return Err(anyhow!(\"MCP client is shut down\"));\n                }\n            }\n        }\n\n        let initialize_context = self","sourceCodeStart":1412,"sourceCodeEnd":1448,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/rmcp-client/src/rmcp_client.rs#L1412-L1448","documentation":"Error \"MCP client recovery semaphore closed\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/rmcp-client/src/rmcp_client.rs:1430 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}