gitbutlerapp/gitbutler · warning
Editor cancelled
Error message
Editor cancelled
What it means
from_builtin_editor launches the user's editor (via run_builtin_editor) to collect text. The editor returns an Option: None signals the user closed/aborted the editor without saving content. In that case from_editor bails with 'Editor cancelled' so the calling command can abort cleanly rather than treating it as empty text.
Solutions
- Re-run the command and save (non-empty) content in the editor this time.
- Check `git var GIT_EDITOR` / EDITOR / VISUAL env vars if the editor exits unexpectedly.
- Pass the text directly via flags/arguments instead of the editor when available, to bypass the editor flow.
Example fix
// before (vim) :q! -> Editor cancelled // after (vim) write and quit: :wq # or set a working editor export EDITOR=vim
Defensive patterns
Strategy: try-catch
Try / catch
match get_text::from_editor(...) {
Err(e) if e.to_string().contains("Editor cancelled") => {
// treat as user abort: skip, don't error
}
other => other?,
} Prevention
- Save non-empty content before closing the editor (:wq, Ctrl-O Ctrl-X)
- Verify EDITOR/GIT_EDITOR/VISUAL point to a working editor
- Provide non-editor flags for scripted usage
When it happens
Trigger: Any flow that opens the editor for input (commit messages, feedback, notes) where the editor exits without producing content — e.g. saving an empty buffer, closing without saving, or the editor being killed.
Common situations: User changes their mind and quits the editor (:q! in vim, Ctrl-X without save in nano); terminal resized/killed mid-edit; GIT_EDITOR misconfigured to something that exits immediately.
Related errors
- command exited with status
- Editor exited with non-zero status
- Editor exited with non-zero status
- File suffix ' ' is not allowed. Must be one of
- No branches selected. Aborting.
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/82a7702631ca9d81.
Report an issue: GitHub.
Appendix: 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 58e5313667)