{"record":{"id":"c688532cde6a1dc4","repo":"gitbutlerapp/gitbutler","slug":"unsupported-platform","errorCode":null,"errorMessage":"Unsupported platform","messagePattern":"Unsupported platform","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-api/src/open/mod.rs","lineNumber":586,"sourceCode":"                cmd.current_dir(canonical_path)\n                    // Keep the window open\n                    .arg(\"-NoExit\");\n                create_new_console(&mut cmd);\n                spawn_and_reap(cmd, \"PowerShell\", canonical_path)?;\n            }\n            \"cmd\" => {\n                // Set the working directory directly - OS handles path format\n                let mut cmd = Command::new(\"cmd\");\n                cmd.current_dir(canonical_path)\n                    // Keep the window open\n                    .arg(\"/K\");\n                create_new_console(&mut cmd);\n                spawn_and_reap(cmd, \"Command Prompt\", canonical_path)?;\n            }\n            _ => bail!(\"Unknown terminal: {terminal_id}\"),\n        };\n    } else {\n        bail!(\"Unsupported platform\");\n    }\n\n    Ok(())\n}\n\n/// Reveals the file or directory at `path` in the platform's file manager.\n///\n/// On macOS this reveals the item in Finder, on Windows it selects the item in\n/// Explorer, and on Linux it opens either the directory itself or the file's\n/// parent directory.\n#[but_api]\n#[instrument(err(Debug))]\npub fn show_in_finder(path: String) -> Result<()> {\n    // Cross-platform implementation to open file/directory in the default file manager\n    // macOS: Opens in Finder (with -R flag to reveal the item)\n    // Windows: Opens in File Explorer\n    // Linux: Opens in the default file manager\n","sourceCodeStart":568,"sourceCodeEnd":604,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-api/src/open/mod.rs#L568-L604","documentation":"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.","triggerScenarios":"Calling open_in_terminal on a platform that is not macOS, Linux, or Windows (e.g. FreeBSD, or code compiled for an unexpected target).","commonSituations":"Running GitButler-derived code on an exotic Unix, an unusual build target, or a test harness faking an unsupported target_os.","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"],"exampleFix":"// before\nopen_in_terminal(\"xterm\", path) // on FreeBSD\n// after: use a supported OS or add an implementation branch\nif cfg!(any(target_os = \"macos\", target_os = \"linux\", target_os = \"windows\")) {\n    open_in_terminal(terminal_id, path)?;\n}","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set(['darwin','linux','win32']);\nif (!SUPPORTED.has(process.platform)) { /* disable terminal-open feature */ }","typeGuard":"fn has_terminal_support() -> bool {\n    cfg!(any(target_os = \"macos\", target_os = \"linux\", target_os = \"windows\"))\n}","tryCatchPattern":"match open_in_terminal(id, path) {\n    Err(e) if e.to_string().contains(\"Unsupported platform\") => disable_terminal_feature(),\n    r => r?,\n}","preventionTips":["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"],"tags":["platform","terminal","unsupported"],"backgroundTag":"unsupported-platform","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"}