{"record":{"id":"da336a5dc97fca0f","repo":"GitoxideLabs/gitoxide","slug":"the-edited-commit-message-is-empty","errorCode":null,"errorMessage":"the edited commit message is empty","messagePattern":"the edited commit message is empty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/create.rs","lineNumber":415,"sourceCode":"        outcome.ref_changes.push(super::undo::RefChange { name, before, after });\n    }\n    Ok(outcome)\n}\n\npub(super) fn commit_from_edit(\n    prepared: &Prepared,\n    edited: &[u8],\n) -> Result<(gix::objs::Commit, crate::enrich::Headers)> {\n    let edit = reword::parse(edited)?;\n    commit_from_parsed_edit(prepared, edit)\n}\n\nfn commit_from_parsed_edit(\n    prepared: &Prepared,\n    edit: reword::Edit<'_>,\n) -> Result<(gix::objs::Commit, crate::enrich::Headers)> {\n    if edit.message.is_empty() {\n        anyhow::bail!(\"the edited commit message is empty\");\n    }\n    Ok((\n        gix::objs::Commit {\n            message: edit.message,\n            tree: prepared.tree,\n            author: reword::actor(edit.author, edit.author_time, \"author\")?,\n            committer: reword::actor(edit.committer, edit.committer_time, \"committer\")?,\n            encoding: None,\n            parents: prepared.parent.into_iter().collect(),\n            extra_headers: Vec::new(),\n        },\n        edit.enrichment,\n    ))\n}\n\n#[cfg(test)]\nmod tests {\n    use std::{path::Path, process::Command};","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/create.rs#L397-L433","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","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."],"exampleFix":"// before (empty buffer saved) -> bail\n// after: ensure message non-empty before invoking\nlet msg = std::fs::read_to_string(msg_file)?;\nif msg.trim().is_empty() { anyhow::bail!(\"provide a non-empty commit message\"); }","handlingStrategy":"try-catch","validationCode":"if edit.message.trim().is_empty() {\n    anyhow::bail!(\"refusing to commit with an empty message\");\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"edited commit message is empty\") => {\n        eprintln!(\"save the editor with a non-empty message, or use -m\");\n    }\n    other => other?,\n}","preventionTips":["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."],"tags":["git","commit-message","validation"],"backgroundTag":"empty-required-field","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}