{"record":{"id":"c688532cde6a1dc4","repo":"gitbutlerapp/gitbutler","slug":"unsupported-platform","errorCode":null,"errorMessage":"Unsupported platform","messagePattern":"Unsupported platform","errorType":"exception","errorClass":"anyhow::Error","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/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-api/src/open/mod.rs#L568-L604","documentation":"open_in_terminal(terminal_id, path) in but-api launches a terminal at a directory. It has explicit branches for macOS, Linux (cfg!(target_os = \"linux\")), and Windows; every other compile target falls through to this unconditional bail. The error means the binary you are running was built for a platform the terminal-launching code simply does not cover.","triggerScenarios":"Invoking open_in_terminal (Tauri command, N-API/SDK openInTerminal, or CLI equivalent) from a build targeting anything other than macOS, Linux, or Windows - e.g. FreeBSD/OpenBSD/illumos builds, or a custom cross-compile target. Note this is a compile-time cfg chain, so the same call site never fails on a supported platform.","commonSituations":"Running the but CLI or embedding but-api on a BSD or niche OS; wasm/emscripten experimental builds; CI cross-compilation smoke tests against unusual targets.","solutions":["Run the app/CLI on macOS, Linux, or Windows - the supported platforms for terminal launching","Gate the 'open in terminal' feature in your UI/CLI on the host platform instead of letting the call fail","If you must support another OS, add a platform branch plus a terminal-id-to-binary mapping in crates/but-api/src/open/mod.rs and crates/but-api/src/open/terminal.rs"],"exampleFix":"// before (TS/SDK caller, always shown)\nawait sdk.openInTerminal(terminalId, path);\n\n// after\nconst supported = ['Darwin', 'Linux', 'Windows_NT'].includes(os.type());\nif (supported) {\n  await sdk.openInTerminal(terminalId, path);\n} else {\n  showInfo('Opening a terminal is not supported on this platform');\n}","handlingStrategy":"validation","validationCode":"// TypeScript caller: gate the action on the host platform\nconst TERMINAL_PLATFORMS = new Set(['Darwin', 'Linux', 'Windows_NT']);\nif (!TERMINAL_PLATFORMS.has(os.type())) {\n  throw new Error(`open_in_terminal: unsupported platform ${os.type()}`);\n}\nawait api.openInTerminal(terminalId, path);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Hide the 'open in terminal' action on any platform other than macOS, Linux, Windows instead of letting the call fail","When porting to a new OS target, remember open/mod.rs is a cfg chain - add the branch before shipping the build","Treat this error as permanent for the session: do not retry, promptless-ly disable the feature"],"tags":["platform","terminal","unsupported-os","but-api"],"backgroundTag":"unsupported-platform","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}