{"record":{"id":"87627522bfa139d1","repo":"Kuberwastaken/claurst","slug":"mcp-server-legacy-sse-stream-ended-before-en","errorCode":null,"errorMessage":"MCP server '{}': legacy SSE stream ended before endpoint discovery","messagePattern":"MCP server '(.+?)': legacy SSE stream ended before endpoint discovery","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-rust/crates/mcp/src/rmcp_backend.rs","lineNumber":333,"sourceCode":"                }\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\n                )\n            })??;\n        *lock_recover(&self.post_endpoint) = Some(endpoint);\n        Ok(())\n    }\n}\n\nimpl Drop for LegacySseRmcpTransport {\n    fn drop(&mut self) {\n        // Some upper-layer paths drop the backend instead of calling close()\n        // explicitly. Abort the listener tasks again here so legacy SSE does\n        // not outlive the connection teardown.\n        let mut tasks = lock_recover(&self.background_tasks);\n        for handle in tasks.drain(..) {\n            handle.abort();\n        }","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/mcp/src/rmcp_backend.rs#L315-L351","documentation":"The legacy SSE stream terminated cleanly before endpoint discovery completed — after the stream task finished, the endpoint receiver channel closed without yielding a POST endpoint. Distinct from a stream error: the stream simply ended (server-side close) while the transport still lacked a discovered endpoint.","triggerScenarios":"Thrown at src-rust/crates/mcp/src/rmcp_backend.rs:333 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the server keeps the SSE connection open during the session","Check intermediaries that may close idle SSE connections","Prefer the streamable-http transport for servers that support it"],"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"}