gitbutlerapp/gitbutler · warning
Editor cancelled
Error message
Editor cancelled
What it means
The built-in TUI editor signals cancellation by returning None from run_builtin_editor; from_editor maps that to this error. It means the user deliberately aborted the input (quit without confirming text) - a normal outcome of an interactive edit, not an editor or system failure.
Source
Thrown at crates/but/src/tui/get_text.rs:158
} else {
super::editor::EditorMode::PullRequest
};
let editor_output = if let Some(rest_text) = rest_text {
let mut initial_text = initial_text.to_owned();
if !initial_text.ends_with('\n') {
initial_text.push('\n');
}
initial_text.push_str(REST_TEXT_MARKER);
initial_text.push('\n');
initial_text.push_str(rest_text);
super::editor::run_builtin_editor(filename_safe_intent, &initial_text, mode)?
} else {
super::editor::run_builtin_editor(filename_safe_intent, initial_text, mode)?
};
match editor_output {
Some(content) => Ok(content.into()),
None => bail!("Editor cancelled"),
}
}
/// Get the user's preferred editor command, if one is configured.
///
/// Runs `git var GIT_EDITOR`, which lets git do its resolution of the editor command.
/// This typically uses the git config value for `core.editor`, and env vars like `GIT_EDITOR` or `EDITOR`.
///
/// Returns `None` when no editor is configured, signalling that the built-in editor should be used.
///
/// Note: Because git config parsing is used, the current directory matters for potential local git config overrides.
pub fn get_editor_command() -> Option<String> {
get_editor_command_impl(std::env::vars_os())
}
/// Internal implementation that can be tested with the controlled environment `env`.
///
/// Checks the standard Git editor sources in precedence order:View on GitHub (pinned to caf1f223d3)
Solutions
- Treat it as a user abort: skip the operation or re-prompt; do not auto-retry the same edit
- In automation, supply the text non-interactively instead of opening an editor
- If cancellation surprises the user, check keybindings for accidental Esc/Ctrl-C
Defensive patterns
Strategy: try-catch
Try / catch
match from_editor("msg", &text, None, ".md") {
Ok(edited) => { /* proceed */ }
Err(e) if e.to_string() == "Editor cancelled" => { /* user abort: exit quietly */ }
Err(e) => return Err(e),
} Prevention
- Match the cancellation message and treat it as a normal abort path
- Offer non-interactive flags (--message/--file) so automation never opens an editor
- Map cancellation to a distinct exit code in wrappers (e.g. 130-style)
When it happens
Trigger: The user exits the builtin editor without confirming - pressing the quit/abort key (Esc/Ctrl-C depending on mode) or ending the session without content, so editor_output is None.
Common situations: Users aborting commit-message or branch-description prompts, scripts treating every non-zero exit as a bug, non-interactive test harnesses where the editor immediately cancels.
Related errors
- File suffix '{}' is not allowed. Must be one of: {}
- Visible worktree {name} was listed more than once
- No diffs to show.
- Aborting due to empty PR title
- cannot mix mark sources
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/82a7702631ca9d81.
Report an issue: GitHub.