{"record":{"id":"7d9b4a5895f958c5","repo":"Hmbown/CodeWhale","slug":"mcp-server-connection-poisoned-by-an-earlier","errorCode":null,"errorMessage":"MCP server '{}': connection poisoned by an earlier panic","messagePattern":"MCP server '(.+?)': connection poisoned by an earlier panic","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/mcp/src/stdio_client.rs","lineNumber":678,"sourceCode":"        self.capabilities.is_none_or(|caps| caps.tools)\n    }\n\n    fn supports_resources(&self) -> bool {\n        self.capabilities.is_none_or(|caps| caps.resources)\n    }\n\n    fn request(&self, method: &str, params: Value) -> Result<Value> {\n        self.request_with_timeout(method, params, self.request_timeout)\n    }\n\n    fn request_with_timeout(\n        &self,\n        method: &str,\n        params: Value,\n        timeout: Duration,\n    ) -> Result<Value> {\n        let mut connection = self.connection.lock().map_err(|_| {\n            anyhow!(\n                \"MCP server '{}': connection poisoned by an earlier panic\",\n                self.server_name\n            )\n        })?;\n        connection.request(&self.server_name, method, params, timeout)\n    }\n\n    /// Drive a paginated `*/list` method to exhaustion, validating every item\n    /// before requesting the next page. A malformed page therefore fails at\n    /// its source rather than being silently thinned or discovered only after\n    /// the rest of the catalog has been fetched.\n    fn list_paginated<T, F>(&self, method: &str, field: &str, mut parse: F) -> Result<Vec<T>>\n    where\n        F: FnMut(&Value, usize) -> Result<T>,\n    {\n        let mut items = Vec::new();\n        let mut cursor: Option<String> = None;\n        let mut budget = ListBudget::new(method, self.request_timeout);","sourceCodeStart":660,"sourceCodeEnd":696,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/mcp/src/stdio_client.rs#L660-L696","documentation":"request_with_timeout guards its connection mutex: a poisoned lock means a previous request panicked while holding the connection, leaving its protocol state unverifiable; all further requests on that MCP stdio connection are refused rather than interleaved with corrupt state. The poison is permanent for that handle.","triggerScenarios":"Thrown at crates/mcp/src/stdio_client.rs:678 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Restart the Codewhale process; the MCP stdio connection mutex was poisoned by an earlier panic and cannot recover in-process.","Report the earlier panic in the MCP server task — fixing that removes the root cause."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}