{"record":{"id":"b0e619806f47ffed","repo":"Kuberwastaken/claurst","slug":"legacy-sse-stream-closed-before-announcing-endpoin","errorCode":null,"errorMessage":"legacy SSE stream closed before announcing endpoint","messagePattern":"legacy SSE stream closed before announcing endpoint","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-rust/crates/mcp/src/rmcp_backend.rs","lineNumber":317,"sourceCode":"                }\n\n                if data.trim().is_empty() {\n                    return Ok(());\n                }\n\n                let message = parse_server_message(&server_name, data)?;\n                let _ = incoming_tx.send(message);\n                Ok(())\n            })\n            .await;\n\n            if let Err(e) = result {\n                tracing::warn!(server = %server_name, error = %e, \"Legacy SSE stream closed with error\");\n                if let Some(tx) = lock_recover(&endpoint_tx_for_task).take() {\n                    let _ = tx.send(Err(anyhow::anyhow!(e.to_string())));\n                }\n            } else if let Some(tx) = lock_recover(&endpoint_tx_for_task).take() {\n                let _ = tx.send(Err(anyhow::anyhow!(\n                    \"legacy SSE stream closed before announcing endpoint\"\n                )));\n            }\n        });\n        lock_recover(&self.background_tasks).push(task);\n\n        let endpoint = tokio::time::timeout(std::time::Duration::from_secs(10), endpoint_rx)\n            .await\n            .map_err(|_| {\n                anyhow::anyhow!(\n                    \"MCP server '{}': timed out waiting for legacy SSE endpoint event\",\n                    self.server_name\n                )\n            })?\n            .map_err(|_| {\n                anyhow::anyhow!(\n                    \"MCP server '{}': legacy SSE stream ended before endpoint discovery\",\n                    self.server_name","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/mcp/src/rmcp_backend.rs#L299-L335","documentation":"The legacy SSE stream task ended (Ok) without ever receiving the `endpoint` event that announces the POST URL. Endpoint discovery is still waiting on the oneshot channel, so this sentinel is sent to fail it: the server closed or idled the stream before disclosing where JSON-RPC messages should be posted.","triggerScenarios":"Thrown at src-rust/crates/mcp/src/rmcp_backend.rs:317 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the server implements the legacy SSE protocol and sends an endpoint event","Check whether a proxy or load balancer is terminating the SSE stream early","Use streamable-http transport instead if supported"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b0637c97ec34144387cbf2f74f65df6d16a6cef1","analyzedAt":"2026-09-10T00:24:58.650Z","contentChangedAt":"2026-09-10T00:24:58.650Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}