Hmbown/CodeWhale · error · StreamableSendError::Other

MCP Streamable HTTP rejected

Error message

MCP Streamable HTTP rejected (transport=http url={} status={}): {}

What it means

A non-success (and non-auth-retryable) status was returned by the MCP Streamable HTTP endpoint. If the status marks the server as Streamable-HTTP-incompatible, an Incompatible error with status/body is produced instead; otherwise this generic rejection error carries the masked URL, HTTP status, and an excerpt of the response body to aid diagnosis.

Solutions

  1. Read the status and body excerpt in the message — a 404 usually means the MCP endpoint URL is wrong
  2. Verify the configured server URL points at the MCP Streamable HTTP endpoint
  3. Check the MCP server's own logs for the corresponding failure
  4. If the server is not Streamable HTTP compatible, switch the transport type for that server

Example fix

// before
"url": "https://example.com/mcp-server"
// after (correct endpoint path)
"url": "https://example.com/mcp"
Defensive patterns

Strategy: try-catch

Try / catch

match client.send(request).await {
    Err(StreamableSendError::Incompatible(msg)) => {
        // server does not speak Streamable HTTP on this URL; switch transport
        use_other_transport(server)?;
    }
    Err(e) if e.to_string().contains("MCP Streamable HTTP rejected") => {
        // parse status/body from the message; fix URL or check server logs
    }
    other => other?,
}

Prevention

When it happens

Trigger: send() gets a non-2xx status from the MCP server POST that is not an auth-session case — e.g. 404 (wrong path), 405 (method not allowed), 500 (server error), 502/503 (proxy/backend down); body excerpt is included in the message.

Common situations: Wrong MCP endpoint URL configured (HTML 404 page from a web server); server behind a proxy returning 502; server does not implement Streamable HTTP at that path; server-side crash on this request.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/src/mcp/streamable_http.rs:149

                )));
            }

            if !status.is_success() {
                let body_excerpt = bounded_body_excerpt(response, ERROR_BODY_PREVIEW_BYTES).await;
                let stale_session = self.session_id.is_some()
                    && is_streamable_http_stale_session_status(status, &body_excerpt);
                let body_excerpt = self.auth.server_error_preview(&body_excerpt);
                if stale_session {
                    return Err(StreamableSendError::StaleSession(format!(
                        "status={status} body={body_excerpt}"
                    )));
                }
                if is_streamable_http_incompatible_status(status) {
                    return Err(StreamableSendError::Incompatible(format!(
                        "status={status} body={body_excerpt}"
                    )));
                }
                return Err(StreamableSendError::Other(anyhow::anyhow!(
                    "MCP Streamable HTTP rejected (transport=http url={} status={}): {}",
                    mask_url_secrets(&self.url),
                    status,
                    body_excerpt,
                )));
            }

            let content_type = response
                .headers()
                .get(CONTENT_TYPE)
                .and_then(|value| value.to_str().ok())
                .map(str::to_string);
            // Reject an over-large declared body before reading anything (fast
            // path), then bound the read itself so chunked / length-less
            // responses cannot OOM us either — Content-Length alone does not
            // protect against a server that streams without declaring a length.
            if let Some(len) = response.content_length()
                && len > MAX_MCP_RESPONSE_BYTES as u64

View on GitHub (pinned to 73e0f67d83)