{"record":{"id":"ce577c449ac6ec76","repo":"gitbutlerapp/gitbutler","slug":"command-exited-with-status","errorCode":null,"errorMessage":"command exited with status {}","messagePattern":"command exited with status (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/but/src/command/legacy/status/tui/app/command_mode.rs","lineNumber":242,"sourceCode":"                    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 {\n            self.push_transient_error(anyhow!(\n                \"command exited with status {}\",\n                format_exit_status(status)\n            ));\n        }\n\n        drop(_suspend_guard);\n\n        Ok(())\n    }\n}\n\n/// Formats an exit status for human-readable error messages.\nfn format_exit_status(status: std::process::ExitStatus) -> String {\n    if let Some(code) = status.code() {\n        code.to_string()\n    } else {\n        status.to_string()\n    }","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/legacy/status/tui/app/command_mode.rs#L224-L260","documentation":"After a TUI command-mode command finishes, the exit status is inspected. On non-zero exit the code surfaces `command exited with status {status}` as a transient error, so the user sees the child failed while the TUI itself stays alive (successful runs instead trigger a workspace reload).","triggerScenarios":"Running any shell command in the TUI command mode whose process terminates with a non-zero status: failing builds/tests, `git` operations rejected by hooks, commands killed by signals, or scripts with `exit 1`.","commonSituations":"Running `npm test` with failing tests, `git push` rejected by a remote hook, `make` compilation errors, or commands that need credentials/stdin the suspended TUI cannot provide.","solutions":["read the command's stdout/stderr output (shown during the run) to find the underlying failure","fix the underlying command failure (build errors, hook rejections, missing auth) and re-run","run the command in a separate terminal if it needs interactive stdin the TUI cannot supply"],"exampleFix":"// before\n> but push   # rejected by pre-push hook\n// after\n# fix hook failure in a terminal, then in TUI:\n> but push","handlingStrategy":"try-catch","validationCode":"// pre-check command success expectations\nif !Command::new(\"sh\").arg(\"-c\").arg(&format!(\"{cmd} --help\")).status().map(|s| s.success()).unwrap_or(false) { eprintln!(\"{cmd} may fail; run it in a terminal first\"); }","typeGuard":null,"tryCatchPattern":"match run_tui_command(cmd) {\n    Err(e) if e.to_string().starts_with(\"command exited with status\") => {\n        eprintln!(\"Fix the underlying failure shown in the command output, then re-run.\");\n    }\n    other => other?,\n}","preventionTips":["test commands in a regular terminal before running them in the TUI","avoid commands requiring interactive stdin inside the TUI","ensure credentials/auth are set up for push/pull commands"],"tags":["cli","process-exit","tui"],"backgroundTag":"git-command-failed","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"}