{"record":{"id":"82ea1f210275097d","repo":"Hmbown/CodeWhale","slug":"mcp-streamable-http-rejected-transport-http-url","errorCode":null,"errorMessage":"MCP Streamable HTTP rejected (transport=http url={} status={}): {}","messagePattern":"MCP Streamable HTTP rejected \\(transport=http url=(.+?) status=(.+?)\\): (.+?)","errorType":"http","errorClass":"StreamableSendError::Other","httpStatus":null,"severity":"error","filePath":"crates/tui/src/mcp/streamable_http.rs","lineNumber":149,"sourceCode":"                )));\n            }\n\n            if !status.is_success() {\n                let body_excerpt = bounded_body_excerpt(response, ERROR_BODY_PREVIEW_BYTES).await;\n                let stale_session = self.session_id.is_some()\n                    && is_streamable_http_stale_session_status(status, &body_excerpt);\n                let body_excerpt = self.auth.server_error_preview(&body_excerpt);\n                if stale_session {\n                    return Err(StreamableSendError::StaleSession(format!(\n                        \"status={status} body={body_excerpt}\"\n                    )));\n                }\n                if is_streamable_http_incompatible_status(status) {\n                    return Err(StreamableSendError::Incompatible(format!(\n                        \"status={status} body={body_excerpt}\"\n                    )));\n                }\n                return Err(StreamableSendError::Other(anyhow::anyhow!(\n                    \"MCP Streamable HTTP rejected (transport=http url={} status={}): {}\",\n                    mask_url_secrets(&self.url),\n                    status,\n                    body_excerpt,\n                )));\n            }\n\n            let content_type = response\n                .headers()\n                .get(CONTENT_TYPE)\n                .and_then(|value| value.to_str().ok())\n                .map(str::to_string);\n            // Reject an over-large declared body before reading anything (fast\n            // path), then bound the read itself so chunked / length-less\n            // responses cannot OOM us either — Content-Length alone does not\n            // protect against a server that streams without declaring a length.\n            if let Some(len) = response.content_length()\n                && len > MAX_MCP_RESPONSE_BYTES as u64","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/mcp/streamable_http.rs#L131-L167","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the status and body excerpt in the message — a 404 usually means the MCP endpoint URL is wrong","Verify the configured server URL points at the MCP Streamable HTTP endpoint","Check the MCP server's own logs for the corresponding failure","If the server is not Streamable HTTP compatible, switch the transport type for that server"],"exampleFix":"// before\n\"url\": \"https://example.com/mcp-server\"\n// after (correct endpoint path)\n\"url\": \"https://example.com/mcp\"","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match client.send(request).await {\n    Err(StreamableSendError::Incompatible(msg)) => {\n        // server does not speak Streamable HTTP on this URL; switch transport\n        use_other_transport(server)?;\n    }\n    Err(e) if e.to_string().contains(\"MCP Streamable HTTP rejected\") => {\n        // parse status/body from the message; fix URL or check server logs\n    }\n    other => other?,\n}","preventionTips":["Curl the configured MCP URL during setup and confirm it responds like an MCP endpoint, not a 404 HTML page","Match the transport type (streamable HTTP vs stdio vs SSE) to what the server actually implements","Monitor proxies between client and server for injected error pages"],"tags":["http","mcp","streamable-http","api-error"],"backgroundTag":"http-error-response","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"}