{"record":{"id":"3dd5c704f5a2cc52","repo":"zed-industries/zed","slug":"failed-to-set-url-scheme-3dd5c7","errorCode":null,"errorMessage":"failed to set URL scheme","messagePattern":"failed to set URL scheme","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cloud_api_client/src/websocket/web.rs","lineNumber":65,"sourceCode":"        (message_rx.into_stream().boxed(), task)\n    }\n}\n\nimpl CloudApiClient {\n    pub fn connect(self: &std::sync::Arc<Self>, cx: &App) -> Result<Task<Result<Connection>>> {\n        let client = self.clone();\n        let executor = cx.background_executor().clone();\n        Ok(cx.spawn(async move |_cx| {\n            let mut connect_url = client\n                .http_client\n                .build_zed_cloud_url(\"/client/users/connect\")?;\n            connect_url\n                .set_scheme(match connect_url.scheme() {\n                    \"https\" => \"wss\",\n                    \"http\" => \"ws\",\n                    scheme => return Err(anyhow!(\"invalid URL scheme: {scheme}\")),\n                })\n                .map_err(|_| anyhow!(\"failed to set URL scheme\"))?;\n\n\n            let connect = WebSocket::connect(connect_url).fuse();\n            let timeout = executor.timer(CONNECT_TIMEOUT).fuse();\n            futures::pin_mut!(connect, timeout);\n            let websocket = futures::select_biased! {\n                result = connect => result.map_err(|error| anyhow!(\"failed to connect to Cloud WebSocket: {error}\"))?,\n                _ = timeout => return Err(anyhow!(\"timed out connecting to Cloud WebSocket\")),\n            };\n\n            Ok(Connection::new(websocket))\n        }))\n    }\n}\n","sourceCodeStart":47,"sourceCodeEnd":80,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/cloud_api_client/src/websocket/web.rs#L47-L80","documentation":"Returned when url.set_scheme (mapping https→wss, http→ws) rejects the target scheme. The URL type only permits certain scheme transitions, so this fires when the built Zed Cloud URL cannot be converted to a WebSocket URL — a defensive guard around an unexpected URL state rather than a user input error.","triggerScenarios":"Thrown at crates/cloud_api_client/src/websocket/web.rs:65 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the Zed Cloud URL is well-formed and its scheme mapping is supported","Report as a bug if it reproduces with a standard https Zed Cloud URL, since the https→wss transition should always succeed"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}