{"record":{"id":"a0244ae7061b2799","repo":"gitbutlerapp/gitbutler","slug":"command-not-found","errorCode":null,"errorMessage":"command not found","messagePattern":"command not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/but/src/command/legacy/status/tui/app/command_mode.rs","lineNumber":223,"sourceCode":"                        return Ok(());\n                    }\n                };\n                let Some(binary) = args.next() else {\n                    return Ok(());\n                };\n                let mut cmd = Command::new(binary);\n                cmd.args(args);\n                cmd\n            }\n        };\n\n        cmd.current_dir(ctx.workdir_or_fail()?);\n\n        let mut child = match cmd.spawn() {\n            Ok(child) => child,\n            Err(err) => {\n                if err.kind() == std::io::ErrorKind::NotFound {\n                    self.push_transient_error(anyhow!(\"command not found\"));\n                    return Ok(());\n                } else {\n                    return Err(err).context(\"failed to start command\");\n                }\n            }\n        };\n        let status = child.wait()?;\n\n        if !IN_TEST {\n            out.prompt_single_line(\"\\npress enter to continue...\")?;\n        }\n\n        if status.success() {\n            messages.extend([\n                Message::EnterNormalModeAfterConfirmingOperation,\n                Message::Reload(None, ReloadCause::Mutation),\n            ]);\n        } else {","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/legacy/status/tui/app/command_mode.rs#L205-L241","documentation":"The TUI command mode executes the typed command as a child process. When `Command::spawn()` fails with `std::io::ErrorKind::NotFound`, the binary is not on `PATH`; the code converts this OS error into a user-facing transient error instead of crashing the TUI.","triggerScenarios":"Typing a shell command in the TUI's command mode that references an executable not installed or not on the current `PATH` (note the TUI may have a different `PATH` than your interactive shell).","commonSituations":"Typos in the command name, invoking tools installed via a shell profile not loaded in the TUI's environment (nvm/rvm/pyenv shims), or running the TUI from a systemd/CI environment with a minimal `PATH`.","solutions":["check the command spelling and install the missing binary","use the absolute path to the executable in the command","verify with `echo $PATH` (via the TUI shell) that the tool's directory is on `PATH`"],"exampleFix":"// before\n> rg pattern        # rg not installed\n// after\n> /usr/bin/grep pattern   # or install ripgrep first","handlingStrategy":"try-catch","validationCode":"for cmd in candidate_paths { if Path::new(cmd).exists() { return Some(cmd); } } // resolve absolute path before spawning","typeGuard":null,"tryCatchPattern":"match run_tui_command(input) {\n    Err(e) | Transient(e) if e.to_string().contains(\"command not found\") => {\n        eprintln!(\"'{input}' not on PATH; install it or use an absolute path.\");\n    }\n    other => other?,\n}","preventionTips":["use absolute paths for tools invoked from the TUI","ensure tool install dirs are exported in the environment launching the TUI","double-check command spelling"],"tags":["cli","process-spawn","path"],"backgroundTag":"command-not-found","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"}