GitoxideLabs/gitoxide · error
the edited commit message is empty
Error message
the edited commit message is empty
What it means
After the user saved the commit-message editor (or the parsed reword edit), the resulting message text was empty. tix does not allow commits with an empty message, mirroring git's behavior. The commit is not created.
Solutions
- Re-run the command and enter a non-empty commit message in the editor before saving.
- If scripting, supply the message via the appropriate `-m`/message input instead of the interactive editor.
- Check the editor's cleanup settings (e.g. `git config commit.cleanup`) so comment lines are not the only content being stripped.
Example fix
// before (empty buffer saved) -> bail
// after: ensure message non-empty before invoking
let msg = std::fs::read_to_string(msg_file)?;
if msg.trim().is_empty() { anyhow::bail!("provide a non-empty commit message"); } Defensive patterns
Strategy: try-catch
Validate before calling
if edit.message.trim().is_empty() {
anyhow::bail!("refusing to commit with an empty message");
} Try / catch
match result {
Err(e) if e.to_string().contains("edited commit message is empty") => {
eprintln!("save the editor with a non-empty message, or use -m");
}
other => other?,
} Prevention
- Never save the commit editor with an empty buffer.
- Prefer supplying messages programmatically (`-m`/message file) in automation.
- Review `commit.cleanup` settings so legitimate messages are not stripped to nothing.
When it happens
Trigger: `commit_from_edit` or `apply_message_reporting` -> `commit_from_parsed_edit` receives a `reword::Edit` whose `edit.message` is an empty string, typically because the editor buffer was saved without any text.
Common situations: Opening the editor during an edit/reword and saving an empty file; an editor configured to strip everything (aggressive cleanup mode); automation writing an empty message file to the editor path.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- the edited commit message is empty
- lines in ' ' could not be parsed
- Invalid pathspec - path must not be empty, not be excluded…
- Cannot derive archive format from a file without extension
- Format for extension
AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08).
Data as JSON: /api/errors/da336a5dc97fca0f.
Report an issue: GitHub.
Appendix: source
Thrown at gix-tix/src/edit/create.rs:415
outcome.ref_changes.push(super::undo::RefChange { name, before, after });
}
Ok(outcome)
}
pub(super) fn commit_from_edit(
prepared: &Prepared,
edited: &[u8],
) -> Result<(gix::objs::Commit, crate::enrich::Headers)> {
let edit = reword::parse(edited)?;
commit_from_parsed_edit(prepared, edit)
}
fn commit_from_parsed_edit(
prepared: &Prepared,
edit: reword::Edit<'_>,
) -> Result<(gix::objs::Commit, crate::enrich::Headers)> {
if edit.message.is_empty() {
anyhow::bail!("the edited commit message is empty");
}
Ok((
gix::objs::Commit {
message: edit.message,
tree: prepared.tree,
author: reword::actor(edit.author, edit.author_time, "author")?,
committer: reword::actor(edit.committer, edit.committer_time, "committer")?,
encoding: None,
parents: prepared.parent.into_iter().collect(),
extra_headers: Vec::new(),
},
edit.enrichment,
))
}
#[cfg(test)]
mod tests {
use std::{path::Path, process::Command};View on GitHub (pinned to e73179060b)