{"record":{"id":"6b9cf6c50795eea4","repo":"openai/codex","slug":"hosted-mcp-event-server-was-removed","errorCode":null,"errorMessage":"hosted MCP event server was removed","messagePattern":"hosted MCP event server was removed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/codex-mcp/src/resource_client.rs","lineNumber":88,"sourceCode":"    request: Option<CancellableEventStreamRequest>,\n    runtime_handle: Handle,\n    connection: Option<Arc<McpServerConnection>>,\n    hosted_event_server_removals: watch::Receiver<()>,\n}\n\nimpl McpEventStream {\n    /// Receives the next raw lifecycle notification for this subscription.\n    pub async fn recv(&mut self) -> Result<Option<McpEventNotification>> {\n        let Some(request) = self.request.as_mut() else {\n            return Ok(None);\n        };\n\n        tokio::select! {\n            biased;\n\n            Ok(()) = self.hosted_event_server_removals.changed() => {\n                self.cancel();\n                Err(anyhow!(\"hosted MCP event server was removed\"))\n            }\n            Some(notification) = request.notifications.recv() => {\n                let metadata = notification.get_meta().0.0.clone();\n                let mut params = notification.params;\n                if !metadata.is_empty() {\n                    params.get_or_insert_with(|| json!({}))[\"_meta\"] = Value::Object(metadata);\n                }\n                Ok(Some(McpEventNotification {\n                    method: notification.method,\n                    params,\n                }))\n            }\n            response = &mut request.handle.rx => {\n                self.request = None;\n                self.connection = None;\n\n                match response {\n                    Ok(Ok(_))","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/codex-mcp/src/resource_client.rs#L70-L106","documentation":"Error surfaced by McpEventStream::recv: the watch channel signaled that the hosted event server backing this subscription was removed, so the stream can no longer deliver notifications and is terminated with this error instead of returning None silently.","triggerScenarios":"Thrown at codex-rs/codex-mcp/src/resource_client.rs:88 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-register or reconnect the hosted MCP event server and retry the operation."],"exampleFix":null,"handlingStrategy":"fallback","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"}