{"record":{"id":"8bc805f8063d4c1f","repo":"zed-industries/zed","slug":"invalid-url-scheme-scheme-8bc805","errorCode":null,"errorMessage":"invalid URL scheme: {scheme}","messagePattern":"invalid URL scheme: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cloud_api_client/src/websocket/web.rs","lineNumber":63,"sourceCode":"        });\n\n        (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":45,"sourceCodeEnd":80,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/crates/cloud_api_client/src/websocket/web.rs#L45-L80","documentation":"Web (wasm) build of the Cloud WebSocket connect: the /client/users/connect URL must switch https→wss or http→ws, and this error fires when the URL's scheme is anything else. Functionally identical to the native variant, but on the browser code path.","triggerScenarios":"build_zed_cloud_url yields a scheme other than http/https on the wasm target — custom cloud base URL with wss:// or another scheme, or a hosting environment rewriting the base URL.","commonSituations":"Custom deployments of the web build with misconfigured base URLs; env vars intended for native leaking into web builds.","solutions":["Configure the cloud base URL as https:// and let the code derive wss","Verify the final connect URL scheme in browser devtools network panel","Remove scheme-specific overrides from the web build config"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let connect_url = client.http_client.build_zed_cloud_url(\"/client/users/connect\")?;\nif !matches!(connect_url.scheme(), \"http\" | \"https\") {\n    return Err(anyhow!(\"cloud base URL must be http(s), got {}\", connect_url.scheme()));\n}","typeGuard":"fn is_http_cloud_url(url: &url::Url) -> bool {\n    matches!(url.scheme(), \"http\" | \"https\") && url.host_str().is_some()\n}","tryCatchPattern":null,"preventionTips":["Keep one URL builder shared between native and wasm paths so validation is identical","Assert scheme in integration tests for the web build","Document that custom cloud URLs must always be https"],"tags":["configuration","url","websocket","wasm"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}