{"record":{"id":"ebcca7867c3eb379","repo":"Kuberwastaken/claurst","slug":"invalid-legacy-sse-base-url","errorCode":null,"errorMessage":"invalid legacy SSE base URL '{}': {}","messagePattern":"invalid legacy SSE base URL '(.+?)': (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-rust/crates/mcp/src/lib.rs","lineNumber":423,"sourceCode":"    pub(crate) fn is_event_stream_response(response: &reqwest::Response) -> bool {\r\n        response\r\n            .headers()\r\n            .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","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/mcp/src/lib.rs#L405-L441","documentation":"When a legacy SSE MCP server advertises an `endpoint` event whose URL is not absolute, the library resolves it against the configured base URL. This error is thrown if the base URL itself fails url::Url::parse, i.e. the server's configured base URL is not a valid absolute URL.","triggerScenarios":"Legacy SSE transport receives an `endpoint` event with a relative path, and the McpServerConfig URL used as base_url is malformed (missing scheme, spaces, control characters) so url::Url::parse fails.","commonSituations":"Config typo like `localhost:8080/sse` (no scheme) or `http://se rver/sse`; env-var interpolated URL with stray spaces; base URL read from an unvalidated settings field.","solutions":["Fix the server URL in the MCP config to a valid absolute URL including scheme (http:// or https://)","Trim whitespace/control characters from the configured URL","Validate the URL with url::Url::parse before storing it in config","If the endpoint should be absolute, correct the server's advertised endpoint event"],"exampleFix":"// before\n\"url\": \"localhost:8080/sse\"\n// after\n\"url\": \"http://localhost:8080/sse\"","handlingStrategy":"validation","validationCode":"fn valid_base_url(s: &str) -> bool {\n    url::Url::parse(s).map(|u| u.scheme().starts_with(\"http\")).unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Store MCP server URLs with explicit http(s):// scheme","Trim config/env URL values before use","Validate URLs at config parse time, not at connect time"],"tags":["url","mcp","sse","configuration"],"backgroundTag":"invalid-url-format","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"}