{"record":{"id":"c3c09448f3d4a1d3","repo":"zed-industries/zed","slug":"invalid-url-scheme-scheme","errorCode":null,"errorMessage":"invalid URL scheme: {scheme}","messagePattern":"invalid URL scheme: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cloud_api_client/src/websocket/native.rs","lineNumber":71,"sourceCode":"                    }\n                }\n            }\n        });\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 mut connect_url = self\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 => Err(anyhow!(\"invalid URL scheme: {scheme}\"))?,\n            })\n            .map_err(|_| anyhow!(\"failed to set URL scheme\"))?;\n\n        let credentials = self.credentials.read();\n        let credentials = credentials.as_ref().context(\"no credentials provided\")?;\n        let authorization_header = format!(\"{} {}\", credentials.user_id, credentials.access_token);\n\n        Ok(gpui_tokio::Tokio::spawn_result(cx, async move {\n            let websocket = WebSocket::connect(connect_url)\n                .with_request(\n                    request::Builder::new()\n                        .header(\"Authorization\", authorization_header)\n                        .header(PROTOCOL_VERSION_HEADER_NAME, PROTOCOL_VERSION.to_string()),\n                )\n                .await?;\n\n            Ok(Connection::new(websocket))\n        }))","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/crates/cloud_api_client/src/websocket/native.rs#L53-L89","documentation":"To open the Cloud WebSocket on native targets, the /client/users/connect URL scheme must be upgraded https→wss or http→ws. This error fires when build_zed_cloud_url produced a URL with any other scheme, so no websocket scheme mapping exists.","triggerScenarios":"A custom cloud base URL configured with a scheme other than http/https (e.g. wss://, file://), producing a connect URL whose scheme matches neither branch of the match.","commonSituations":"Self-hosted or enterprise deployments overriding the cloud base URL and mistakenly entering a websocket scheme; typo'd environment configuration.","solutions":["Set the cloud base URL to https:// (the code derives wss itself)","Print/verify the resolved URL before connect and check its scheme","Remove any stale custom-URL overrides and retry with defaults"],"exampleFix":"# before\nexport ZED_CLOUD_URL=wss://cloud.example.com\n\n# after\nexport ZED_CLOUD_URL=https://cloud.example.com","handlingStrategy":"validation","validationCode":"let connect_url = http_client.build_zed_cloud_url(\"/client/users/connect\")?;\nif !matches!(connect_url.scheme(), \"http\" | \"https\") {\n    anyhow::bail!(\"cloud base URL must be http(s), got scheme {}\", 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":["Validate the cloud base URL scheme at config load","Document that base URLs use https; websocket schemes are derived internally","Fail fast with a config error instead of at connection time"],"tags":["configuration","url","websocket","cloud"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}