{"record":{"id":"1501d8af820a67d1","repo":"gitbutlerapp/gitbutler","slug":"invalid-path-scheme","errorCode":null,"errorMessage":"Invalid path scheme: {}","messagePattern":"Invalid path scheme: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-api/src/open/mod.rs","lineNumber":58,"sourceCode":"/// be converted to a path, or every available opener command fails to launch.\npub(crate) fn open_that(target_url: &Url) -> anyhow::Result<()> {\n    if ![\n        \"http\",\n        \"https\",\n        \"mailto\",\n        \"vscode\",\n        \"vscodium\",\n        \"vscode-insiders\",\n        \"zed\",\n        \"windsurf\",\n        \"cursor\",\n        \"trae\",\n        \"antigravity-ide\",\n        \"file\",\n    ]\n    .contains(&target_url.scheme())\n    {\n        bail!(\"Invalid path scheme: {}\", target_url.scheme());\n    }\n\n    if open_editor_url_as_command_invocation_on_wsl(target_url) {\n        return Ok(());\n    }\n\n    fn clean_env_vars<'a, 'b>(\n        var_names: &'a [&'b str],\n    ) -> impl Iterator<Item = (&'b str, String)> + 'a {\n        var_names\n            .iter()\n            .filter_map(|name| env::var(name).map(|value| (*name, value)).ok())\n            .map(|(name, value)| {\n                (\n                    name,\n                    value\n                        .split(':')\n                        .filter(|path| {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-api/src/open/mod.rs#L40-L76","documentation":"open_that() whitelists a fixed set of URL schemes (http, https, mailto, editor schemes like vscode/zed/cursor, and file). If the URL passed to open_url or show_in_finder has any other scheme, it refuses to hand it to the OS opener with this error. It guards against invoking system openers on arbitrary or unsupported URL types.","triggerScenarios":"Calling open_url with a URL whose scheme is not in the allowlist, e.g. ftp://, ssh://, custom-app://, or a malformed string parsed as an unexpected scheme.","commonSituations":"A frontend or plugin passes a raw path without the file:// prefix, a deep link with a custom scheme is forwarded, or an editor integration emits a scheme not yet in the allowlist.","solutions":["Use a supported scheme: convert local paths to file:// URLs before calling open_url","Use http(s):// or mailto: for remote resources","If a new editor/IDE scheme is needed, add it to the allowlist in crates/but-api/src/open/mod.rs"],"exampleFix":"// before\nopen_url(Url::parse(\"ftp://example.com/file\")?)\n// after\nopen_url(Url::parse(\"https://example.com/file\")?)","handlingStrategy":"validation","validationCode":"const SUPPORTED: [&str; 12] = [\"http\",\"https\",\"mailto\",\"vscode\",\"vscodium\",\"vscode-insiders\",\"zed\",\"windsurf\",\"cursor\",\"trae\",\"antigravity-ide\",\"file\"];\nfn can_open(url: &Url) -> bool { SUPPORTED.contains(&url.scheme()) }","typeGuard":"fn is_supported_url(url: &Url) -> bool {\n    matches!(url.scheme(), \"http\"|\"https\"|\"mailto\"|\"file\"|\"vscode\"|\"vscodium\"|\"vscode-insiders\"|\"zed\"|\"windsurf\"|\"cursor\"|\"trae\"|\"antigravity-ide\")\n}","tryCatchPattern":null,"preventionTips":["Always convert local paths to file:// URLs before opening","Validate URL scheme at the UI boundary before calling open_url","Keep the scheme allowlist in sync when adding editor integrations"],"tags":["url","validation","scheme"],"backgroundTag":"invalid-url","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}