{"record":{"id":"6370bd9ae3d81cb6","repo":"Kuberwastaken/claurst","slug":"failed-to-resolve-legacy-sse-endpoint","errorCode":null,"errorMessage":"failed to resolve legacy SSE endpoint '{}': {}","messagePattern":"failed to resolve legacy SSE endpoint '(.+?)': (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-rust/crates/mcp/src/lib.rs","lineNumber":426,"sourceCode":"            .get(CONTENT_TYPE)\r\n            .and_then(|value| value.to_str().ok())\r\n            .map(|value| value.contains(\"text/event-stream\"))\r\n            .unwrap_or(false)\r\n    }\r\n\r\n    pub(crate) fn resolve_legacy_endpoint(base_url: &str, endpoint: &str) -> anyhow::Result<String> {\r\n        let endpoint = endpoint.trim();\r\n        if endpoint.is_empty() {\r\n            anyhow::bail!(\"legacy SSE endpoint event did not include a POST endpoint\");\r\n        }\r\n        if let Ok(url) = url::Url::parse(endpoint) {\r\n            return Ok(url.to_string());\r\n        }\r\n        let base = url::Url::parse(base_url)\r\n            .map_err(|e| anyhow::anyhow!(\"invalid legacy SSE base URL '{}': {}\", base_url, e))?;\r\n        base.join(endpoint)\r\n            .map(|url| url.to_string())\r\n            .map_err(|e| anyhow::anyhow!(\"failed to resolve legacy SSE endpoint '{}': {}\", endpoint, e))\r\n    }\r\n\r\n    #[cfg(test)]\r\n    pub(super) fn route_incoming_value(\r\n        server_name: &str,\r\n        value: serde_json::Value,\r\n        response_tx: &mpsc::UnboundedSender<JsonRpcResponse>,\r\n        notification_tx: &mpsc::UnboundedSender<serde_json::Value>,\r\n    ) -> anyhow::Result<()> {\r\n        let is_response = value.get(\"id\").map(|id| !id.is_null()).unwrap_or(false)\r\n            || value.get(\"result\").is_some()\r\n            || value.get(\"error\").is_some();\r\n\r\n        if is_response {\r\n            let response: JsonRpcResponse = serde_json::from_value(value).map_err(|e| {\r\n                anyhow::anyhow!(\r\n                    \"MCP server '{}': failed to parse JSON-RPC response from HTTP transport: {}\",\r\n                    server_name,\r","sourceCodeStart":408,"sourceCodeEnd":444,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/mcp/src/lib.rs#L408-L444","documentation":"For legacy SSE MCP servers, a relative `endpoint` event value is joined onto the base URL with Url::join. This error fires when the join itself fails, meaning the endpoint string from the server cannot be resolved against the base URL (e.g. the join produced no valid URL).","triggerScenarios":"Legacy SSE handshake returns an endpoint event with a malformed relative path that Url::join rejects when combined with the server base URL.","commonSituations":"Server (or an intermediate proxy) advertises a corrupted endpoint value such as `http://[bad-ipv6/endpoint`; reverse proxy rewriting the SSE endpoint event incorrectly; nonstandard MCP server implementation.","solutions":["Inspect the server's `endpoint` event output and fix the server/proxy so it advertises a valid endpoint path or absolute URL","Update or replace the non-compliant MCP server implementation","Bypass proxies that rewrite SSE handshake events","Ensure the endpoint string contains only valid URL path/query characters"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match connect(cfg).await {\n    Err(e) if e.to_string().contains(\"failed to resolve legacy SSE endpoint\") => {\n        // log raw endpoint event, disable or upgrade that server\n    }\n    r => r?,\n}","preventionTips":["Keep MCP servers and proxies compliant with the SSE handshake spec","Test behind reverse proxies for endpoint-rewriting behavior","Prefer streamable-http transport where supported"],"tags":["url","mcp","sse","network"],"backgroundTag":"invalid-url","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"}