{"record":{"id":"98477c6766f1fc17","repo":"GitoxideLabs/gitoxide","slug":"editor-editor-display-exited-with-status","errorCode":null,"errorMessage":"Editor {editor_display} exited with {status}","messagePattern":"Editor (.+?) exited with (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"gitoxide-core/src/repository/editor.rs","lineNumber":18,"sourceCode":"use std::path::PathBuf;\n\nuse anyhow::{Context, Result, bail};\n\npub fn function(repo: gix::Repository, paths: Vec<PathBuf>) -> Result<()> {\n    let editor = repo\n        .editor_command()\n        .context(\"Could not prepare editor\")?\n        .context(\"No editor is configured and the terminal is not capable of running one\")?;\n    let editor_display = editor.command.to_string_lossy().into_owned();\n    let status = editor\n        .args(paths)\n        .spawn()\n        .with_context(|| format!(\"Could not launch editor {editor_display}\"))?\n        .wait()\n        .with_context(|| format!(\"Could not wait for editor {editor_display}\"))?;\n    if !status.success() {\n        bail!(\"Editor {editor_display} exited with {status}\");\n    }\n    Ok(())\n}\n","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gitoxide-core/src/repository/editor.rs#L1-L22","documentation":"The editor helper spawns an external editor process (e.g. for commit messages or interactive input), waits for it, and throws this error if the editor exits with a non-zero status. A launch or wait failure is wrapped in separate context errors; this specific error is the editor's own non-success exit code.","triggerScenarios":"Calling the function in gitoxide-core/src/repository/editor.rs with a configured editor program that runs but returns a non-zero exit status — e.g. the editor crashed, the user aborted a save, or the editor wrote errors to stderr.","commonSituations":"Core.editor / GIT_EDITOR / EDITOR misconfiguration pointing at a broken or missing-editor wrapper script; user aborts in the editor (some editors exit non-zero on abort); terminal/shell wrapper returning errors.","solutions":["Check the editor's stderr output to see why it failed","Verify $GIT_EDITOR / $EDITOR / core.editor points to a working editor","Test the editor command manually in a terminal with a sample file","Fix or replace the editor wrapper script that exits non-zero"],"exampleFix":"// before (env)\nGIT_EDITOR=/usr/bin/broken-editor\n// after (env)\nGIT_EDITOR=/usr/bin/vim","handlingStrategy":"try-catch","validationCode":"// verify editor is executable before spawning\nlet ok = std::process::Command::new(\"sh\")\n    .arg(\"-c\")\n    .arg(format!(\"command -v {} >/dev/null\", editor))\n    .status()\n    .map(|s| s.success())\n    .unwrap_or(false);\nif !ok { eprintln!(\"editor '{editor}' not available\"); }","typeGuard":null,"tryCatchPattern":"match edit(&editor, &paths) {\n    Err(e) if e.to_string().contains(\"exited with\") => {\n        eprintln!(\"editor failed or was aborted: {e}\");\n        std::process::exit(1);\n    }\n    other => other?,\n}","preventionTips":["Set GIT_EDITOR / EDITOR to a known-working program","Test the editor command manually before relying on it in scripts","Check editor stderr to diagnose non-zero exits","Avoid editor wrapper scripts that exit non-zero on normal saves"],"tags":["editor","external-process","exit-code"],"backgroundTag":"git-command-failed","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}