gitbutlerapp/gitbutler · error
Invalid path scheme
Error message
Invalid path scheme: {} What it means
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.
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
Example fix
// before
open_url(Url::parse("ftp://example.com/file")?)
// after
open_url(Url::parse("https://example.com/file")?) Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED: [&str; 12] = ["http","https","mailto","vscode","vscodium","vscode-insiders","zed","windsurf","cursor","trae","antigravity-ide","file"];
fn can_open(url: &Url) -> bool { SUPPORTED.contains(&url.scheme()) } Type guard
fn is_supported_url(url: &Url) -> bool {
matches!(url.scheme(), "http"|"https"|"mailto"|"file"|"vscode"|"vscodium"|"vscode-insiders"|"zed"|"windsurf"|"cursor"|"trae"|"antigravity-ide")
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.
Related errors
- Clone remote URL contains unsupported control characters
- must be an HTTP or HTTPS URL
- Refusing to remove label with degenerate name
- is not from a trusted GitButler domain
- must use HTTPS
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/1501d8af820a67d1.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-api/src/open/mod.rs:58
/// be converted to a path, or every available opener command fails to launch.
pub(crate) fn open_that(target_url: &Url) -> anyhow::Result<()> {
if ![
"http",
"https",
"mailto",
"vscode",
"vscodium",
"vscode-insiders",
"zed",
"windsurf",
"cursor",
"trae",
"antigravity-ide",
"file",
]
.contains(&target_url.scheme())
{
bail!("Invalid path scheme: {}", target_url.scheme());
}
if open_editor_url_as_command_invocation_on_wsl(target_url) {
return Ok(());
}
fn clean_env_vars<'a, 'b>(
var_names: &'a [&'b str],
) -> impl Iterator<Item = (&'b str, String)> + 'a {
var_names
.iter()
.filter_map(|name| env::var(name).map(|value| (*name, value)).ok())
.map(|(name, value)| {
(
name,
value
.split(':')
.filter(|path| {View on GitHub (pinned to 58e5313667)