Hmbown/CodeWhale · error

Timed out waiting for MCP JSON-RPC response from server

Error message

Timed out waiting for MCP JSON-RPC response from server '{}' after {}s

What it means

An MCP server did not answer a JSON-RPC request within the connection's configured read timeout (`read_timeout_secs`). The pending `oneshot` receiver returned `Err` (sender dropped) or the future timed out, so the client marks the connection `Disconnected` and aborts with this error. It indicates the server process is hung, slow, or died without responding.

Solutions

  1. Check the MCP server starts and responds: run its command manually and issue a request over stdio.
  2. Increase `read_timeout_secs` in the MCP timeouts config for that server.
  3. Check server logs/stderr for a crash or hang; fix or reinstall the server binary.
  4. Retry the operation; the connection was set to Disconnected so the next call will reconnect.

Example fix

// before (too-tight timeout in config.toml)
[mcp.timeouts]
read_timeout_secs = 2
// after
[mcp.timeouts]
read_timeout_secs = 30
Defensive patterns

Strategy: retry

Validate before calling

if server_timeouts.read_timeout_secs < 5 {
    return Err("read_timeout_secs too small for MCP server; raise before calling");
}

Try / catch

match connection.call_tool(req).await {
    Err(e) if e.to_string().contains("Timed out waiting for MCP JSON-RPC") => {
        // connection is now Disconnected; reconnect and retry once with a larger timeout
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling any McpConnection JSON-RPC method (e.g. tools/list, tools/call) when the awaited response channel closes or exceeds `self.read_timeout_secs`; typically because the spawned server process never wrote a response to stdout.

Common situations: MCP server binary missing or crashing on startup, server wedged on a slow tool call, overly tight `read_timeout_secs` in the timeouts config, server blocked reading stdin or waiting on an external API.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/src/mcp.rs:2421

                Duration::from_secs(self.read_timeout_secs),
                async {
                    tokio::select! {
                        biased;
                        _ = self.cancel_token.cancelled() => {
                            anyhow::bail!("MCP connection '{}' was cancelled", self.name)
                        }
                        result = self.transport.recv() => result,
                    }
                },
            )
            .await
            {
                Ok(result) => result.inspect_err(|_e| {
                    self.state = ConnectionState::Disconnected;
                })?,
                Err(_) => {
                    self.state = ConnectionState::Disconnected;
                    anyhow::bail!(
                        "Timed out waiting for MCP JSON-RPC response from server '{}' after {}s",
                        self.name,
                        self.read_timeout_secs
                    );
                }
            };
            let value: serde_json::Value = match serde_json::from_slice(&bytes) {
                Ok(value) => value,
                Err(err) => {
                    self.state = ConnectionState::Disconnected;
                    let preview = if self.config.reviewed_plugin.is_some() {
                        "<server details suppressed for reviewed plugin>".to_string()
                    } else {
                        invalid_json_preview(&bytes)
                    };
                    return Err(err).with_context(|| {
                        format!(
                            "Invalid MCP JSON-RPC message from server '{}': {}",

View on GitHub (pinned to 73e0f67d83)