zed-industries/zed · error

Context server request timeout

Error message

Context server request timeout

What it means

Zed's context-server (MCP) client wraps every request with an optional timeout; when the server does not answer within it, the pending request task is cancelled and this error is returned, with an accompanying `log::error!` naming the method, request id, and timeout duration. It signals a slow or hung MCP server, not a protocol error.

Solutions

  1. Increase the request timeout for the server in Zed settings (`context_servers` → `request_timeout` in seconds).
  2. Check the MCP server's own logs — if it errors instead of hanging, fix the server; if it is just slow, tune the timeout above its real duration.
  3. Restart the context server (or Zed) to clear hung states; a server that never replies to `tools/list` is likely broken, not slow.
  4. For operations known to be long, prefer tools that return progress/async results rather than blocking the request.

Example fix

// before: default/short timeout; long tool call fails
// settings.json (Zed):
// "context_servers": { "my-server": { "settings": { ... } } }

// after: raise the timeout for MCP requests
// settings.json (Zed):
"context_servers": {
  "request_timeout": 180,
  "my-server": { "settings": { "url": "..." } }
}
Defensive patterns

Strategy: retry

Validate before calling

// Before a long operation, check the configured budget matches expectations
if let Some(timeout) = request_timeout {
    anyhow::ensure!(expected_max_duration < timeout, "operation will exceed the MCP request_timeout");
}

Try / catch

match context_server.request(method, params, Some(timeout)).await {
    Err(err) if err.to_string() == "Context server request timeout" => {
        // request was cancelled server-side; only retry if idempotent
        if idempotent { context_server.request(method, params, Some(timeout * 2)).await } else { Err(err) }
    }
    result => result,
}

Prevention

When it happens

Trigger: Any MCP request (`tools/list`, `tools/call`, `prompts/get`, ...) exceeding the configured `request_timeout` for that server: server tool doing slow I/O, server waiting on a downstream API, or a deadlocked server process. Trigger fires from the `timeout_fut` branch of the select over cancel/timeout.

Common situations: MCP tool that hits a slow external API (search, build, index) exceeding the default timeout; server stuck on startup initialization; overloaded machine; timeout configured too low for legitimately long operations in Zed settings (`context_servers.request_timeout` or per-server).

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 zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/84c1a89a4071e635. Report an issue: GitHub.

Appendix: source

Thrown at crates/context_server/src/client.rs:483

                            return Err(err);
                        }
                        anyhow::bail!("cancelled")
                    }
                }
            }
            _ = cancel_fut => {
                self.notify(
                    Cancelled::METHOD,
                    ClientNotification::Cancelled(CancelledParams {
                        request_id: RequestId::Int(id),
                        reason: None
                    })
                ).log_err();
                anyhow::bail!(RequestCanceled)
            }
            _ = timeout_fut => {
                log::error!("cancelled csp request task for {method:?} id {id} which took over {:?}", timeout.unwrap());
                anyhow::bail!("Context server request timeout");
            }
        }
    }

    /// Sends a notification to the context server without expecting a response.
    /// This function serializes the notification and sends it through the outbound channel.
    pub fn notify(&self, method: &str, params: impl Serialize) -> Result<()> {
        let notification = serde_json::to_string(&Notification {
            jsonrpc: JSON_RPC_VERSION,
            method,
            params,
        })
        .unwrap();
        self.outbound_tx.try_send(notification)?;
        Ok(())
    }

    /// Notify the underlying transport of the negotiated MCP protocol version

View on GitHub (pinned to f4178619ac)