{"record":{"id":"5524276bd2e5448a","repo":"Hmbown/CodeWhale","slug":"mcp-sse-post-rejected-transport-sse-endpoint-s","errorCode":null,"errorMessage":"MCP SSE POST rejected (transport=sse endpoint={} status={}): {}","messagePattern":"MCP SSE POST rejected \\(transport=sse endpoint=(.+?) status=(.+?)\\): (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/mcp/sse.rs","lineNumber":304,"sourceCode":"            format!(\n                \"MCP SSE POST send failed (transport=sse endpoint={})\",\n                mask_url_secrets(&endpoint)\n            )\n        })?;\n        let status = response.status();\n        if !status.is_success() {\n            let body_excerpt = bounded_body_excerpt(response, ERROR_BODY_PREVIEW_BYTES).await;\n            let stale_session = is_mcp_stale_session_body(&body_excerpt);\n            let body_excerpt = self.auth.server_error_preview(&body_excerpt);\n            if stale_session {\n                anyhow::bail!(\n                    \"MCP session expired (transport=sse endpoint={} status={}): {}\",\n                    mask_url_secrets(&endpoint),\n                    status,\n                    body_excerpt\n                );\n            }\n            anyhow::bail!(\n                \"MCP SSE POST rejected (transport=sse endpoint={} status={}): {}\",\n                mask_url_secrets(&endpoint),\n                status,\n                body_excerpt\n            );\n        }\n        Ok(())\n    }\n\n    async fn recv(&mut self) -> Result<Vec<u8>> {\n        loop {\n            match self.receiver.recv().await.context(\"SSE transport closed\")? {\n                SseInbound::Endpoint(endpoint) => {\n                    self.store_endpoint(&endpoint)?;\n                }\n                SseInbound::Message(msg) => return Ok(msg),\n            }\n        }","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/mcp/sse.rs#L286-L322","documentation":"The MCP SSE transport's POST to the session endpoint returned a non-success HTTP status that was not recognized as an expired session. The error includes the masked endpoint URL, status code, and a bounded preview of the response body (with auth-server-specific redaction applied).","triggerScenarios":"Any non-2xx response from the SSE session POST that isn't a stale-session body: 400 malformed JSON-RPC payload, 401/403 auth rejected, 404 unknown endpoint, 5xx server error.","commonSituations":"Expired or revoked auth token (401/403); MCP server API changed so the request shape is rejected (400); server outage (502/503); misconfigured endpoint path returning 404 HTML.","solutions":["Read the status and body excerpt in the message to identify the server's complaint.","For 401/403, refresh or reconfigure credentials for the MCP server.","For 400, check that the MCP server version matches the client's expected protocol.","For 5xx, check server health/logs and retry after the outage.","For 404, verify the endpoint URL/path configuration."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(e) = transport.send(msg).await {\n    let msg = e.to_string();\n    if msg.contains(\"status=401\") || msg.contains(\"status=403\") {\n        refresh_credentials()?; // auth problem\n    } else if msg.contains(\"status=50\") {\n        schedule_retry_with_backoff(); // server-side outage\n    } else {\n        return Err(e); // client-side request problem, do not blind-retry\n    }\n}","preventionTips":["Keep MCP server credentials fresh and scoped correctly.","Pin/verify client-server MCP protocol version compatibility.","Log the masked endpoint and status from the error to triage quickly.","Health-check the MCP server before heavy use."],"tags":["mcp","sse","http-error","post-rejected"],"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"}