Hmbown/CodeWhale · error

MCP server ' ': connection poisoned by an earlier panic

Error message

MCP server '{}': connection poisoned by an earlier panic

What it means

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.

Solutions

  1. Restart the Codewhale process; the MCP stdio connection mutex was poisoned by an earlier panic and cannot recover in-process.
  2. Report the earlier panic in the MCP server task — fixing that removes the root cause.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/mcp/src/stdio_client.rs:678 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/7d9b4a5895f958c5. Report an issue: GitHub.

Appendix: source

Thrown at crates/mcp/src/stdio_client.rs:678

        self.capabilities.is_none_or(|caps| caps.tools)
    }

    fn supports_resources(&self) -> bool {
        self.capabilities.is_none_or(|caps| caps.resources)
    }

    fn request(&self, method: &str, params: Value) -> Result<Value> {
        self.request_with_timeout(method, params, self.request_timeout)
    }

    fn request_with_timeout(
        &self,
        method: &str,
        params: Value,
        timeout: Duration,
    ) -> Result<Value> {
        let mut connection = self.connection.lock().map_err(|_| {
            anyhow!(
                "MCP server '{}': connection poisoned by an earlier panic",
                self.server_name
            )
        })?;
        connection.request(&self.server_name, method, params, timeout)
    }

    /// Drive a paginated `*/list` method to exhaustion, validating every item
    /// before requesting the next page. A malformed page therefore fails at
    /// its source rather than being silently thinned or discovered only after
    /// the rest of the catalog has been fetched.
    fn list_paginated<T, F>(&self, method: &str, field: &str, mut parse: F) -> Result<Vec<T>>
    where
        F: FnMut(&Value, usize) -> Result<T>,
    {
        let mut items = Vec::new();
        let mut cursor: Option<String> = None;
        let mut budget = ListBudget::new(method, self.request_timeout);

View on GitHub (pinned to 73e0f67d83)