{"record":{"id":"ff4b25450012fd72","repo":"jesseduffield/lazygit","slug":"you-cannot-commit-without-a-commit-message-ff4b25","errorCode":null,"errorMessage":"You cannot commit without a commit message","messagePattern":"You cannot commit without a commit message","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/gui/controllers/helpers/commits_helper.go","lineNumber":186,"sourceCode":"\n\tif initialMessageIsPreserved {\n\t\tself.SetPreservedMessageInView(initialMessage)\n\t} else {\n\t\tself.SetMessageAndDescriptionInView(initialMessage)\n\t}\n\n\tself.c.Context().Push(self.c.Contexts().CommitMessage, types.OnFocusOpts{})\n}\n\nfunc (self *CommitsHelper) ClearPreservedCommitMessage() {\n\tself.c.Contexts().CommitMessage.SetPreservedMessageAndLogError(\"\")\n}\n\nfunc (self *CommitsHelper) HandleCommitConfirm() error {\n\tsummary, description := self.getCommitSummary(), self.getCommitDescription()\n\n\tif strings.TrimSpace(summary) == \"\" {\n\t\treturn errors.New(self.c.Tr.CommitWithoutMessageErr)\n\t}\n\n\terr := self.c.Contexts().CommitMessage.OnConfirm(summary, description)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (self *CommitsHelper) PreserveCommitMessage() {\n\tif self.c.Contexts().CommitMessage.GetPreserveMessage() {\n\t\tmessage := self.JoinCommitMessageAndUnwrappedDescription()\n\t\tif message != self.c.Contexts().CommitMessage.GetInitialMessage() {\n\t\t\tself.c.Contexts().CommitMessage.SetPreservedMessageAndLogError(message)\n\t\t}\n\t}\n}","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/controllers/helpers/commits_helper.go#L168-L204","documentation":"Returned by CommitsHelper.HandleCommitConfirm when the user confirms the commit-message panel but the summary line is empty (after TrimSpace). lazygit refuses to create a commit with no subject because git itself requires a non-empty message unless -m '' --allow-empty-message is used deliberately; the description alone is not enough.","triggerScenarios":"Opening the commit message panel (c) and pressing Enter with an empty or whitespace-only summary, e.g. relying only on the description body, or after clearing a prefilled message to abort-but-actually-confirm.","commonSituations":"Users pressing Enter to 'close' the panel instead of Esc; template/prefix auto-fill producing an empty effective summary; clipboard paste landing in the description field instead of the summary.","solutions":["Type a non-empty summary on the first line of the commit panel, then confirm.","Use Esc to abandon the commit instead of confirming an empty message.","If you intended a message-less commit, that is unsupported by design; write a summary."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before confirming the panel:\nif strings.TrimSpace(summary) == \"\" {\n    // abort silently (Esc semantics) instead of confirming\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Train Esc-to-cancel vs Enter-to-confirm muscle memory","Rely on commit message templates to prefill a non-empty summary"],"tags":["git","commit","validation","empty-input"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}