gitbutlerapp/gitbutler · error
Unsupported platform
Error message
Unsupported platform
What it means
open_in_terminal() dispatches by cfg!(target_os) — macOS, Linux, and Windows branches — and bails with 'Unsupported platform' for anything else. It means the current OS has no terminal-launch implementation in this library.
Solutions
- Run on a supported platform (macOS, Linux, or Windows)
- Add a platform branch to open_in_terminal if a new target must be supported
- Guard the call site with a platform check before invoking
Example fix
// before
open_in_terminal("xterm", path) // on FreeBSD
// after: use a supported OS or add an implementation branch
if cfg!(any(target_os = "macos", target_os = "linux", target_os = "windows")) {
open_in_terminal(terminal_id, path)?;
} Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED = new Set(['darwin','linux','win32']);
if (!SUPPORTED.has(process.platform)) { /* disable terminal-open feature */ } Type guard
fn has_terminal_support() -> bool {
cfg!(any(target_os = "macos", target_os = "linux", target_os = "windows"))
} Try / catch
match open_in_terminal(id, path) {
Err(e) if e.to_string().contains("Unsupported platform") => disable_terminal_feature(),
r => r?,
} Prevention
- Feature-gate terminal opening to supported platforms in the UI
- Check cfg!/process.platform before advertising the feature
- Add an implementation branch before porting to a new OS
When it happens
Trigger: Calling open_in_terminal on a platform that is not macOS, Linux, or Windows (e.g. FreeBSD, or code compiled for an unexpected target).
Common situations: Running GitButler-derived code on an exotic Unix, an unusual build target, or a test harness faking an unsupported target_os.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- Native file picker is not supported on this platform
- Ad-hoc (single-branch) branch moves are not supported…
- Automatic CLI installation is only supported on macOS. See…
- Azure is unsupported at the minute. Sorry 😞.
- bare repositories are not supported
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/c688532cde6a1dc4.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-api/src/open/mod.rs:586
cmd.current_dir(canonical_path)
// Keep the window open
.arg("-NoExit");
create_new_console(&mut cmd);
spawn_and_reap(cmd, "PowerShell", canonical_path)?;
}
"cmd" => {
// Set the working directory directly - OS handles path format
let mut cmd = Command::new("cmd");
cmd.current_dir(canonical_path)
// Keep the window open
.arg("/K");
create_new_console(&mut cmd);
spawn_and_reap(cmd, "Command Prompt", canonical_path)?;
}
_ => bail!("Unknown terminal: {terminal_id}"),
};
} else {
bail!("Unsupported platform");
}
Ok(())
}
/// Reveals the file or directory at `path` in the platform's file manager.
///
/// On macOS this reveals the item in Finder, on Windows it selects the item in
/// Explorer, and on Linux it opens either the directory itself or the file's
/// parent directory.
#[but_api]
#[instrument(err(Debug))]
pub fn show_in_finder(path: String) -> Result<()> {
// Cross-platform implementation to open file/directory in the default file manager
// macOS: Opens in Finder (with -R flag to reveal the item)
// Windows: Opens in File Explorer
// Linux: Opens in the default file manager
View on GitHub (pinned to 58e5313667)