{"record":{"id":"833c30e33b4e4de7","repo":"jesseduffield/lazygit","slug":"no-patch-created-yet-to-start-building-a-patch-u","errorCode":null,"errorMessage":"No patch created yet. To start building a patch, use 'space' on a commit file or enter to add specific lines","messagePattern":"No patch created yet\\. To start building a patch, use 'space' on a commit file or enter to add specific lines","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"pkg/gui/controllers/custom_patch_options_menu_action.go","lineNumber":22,"sourceCode":"\t\"errors\"\n\t\"fmt\"\n\n\t\"github.com/jesseduffield/generics/set\"\n\t\"github.com/jesseduffield/lazygit/pkg/commands/models\"\n\t\"github.com/jesseduffield/lazygit/pkg/gocui\"\n\t\"github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers\"\n\t\"github.com/jesseduffield/lazygit/pkg/gui/types\"\n\t\"github.com/jesseduffield/lazygit/pkg/utils\"\n\t\"github.com/samber/lo\"\n)\n\ntype CustomPatchOptionsMenuAction struct {\n\tc *ControllerCommon\n}\n\nfunc (self *CustomPatchOptionsMenuAction) Call() error {\n\tif !self.c.Git().Patch.PatchBuilder.Active() {\n\t\treturn errors.New(self.c.Tr.NoPatchError)\n\t}\n\n\tif self.c.Git().Patch.PatchBuilder.IsEmpty() {\n\t\treturn errors.New(self.c.Tr.EmptyPatchError)\n\t}\n\n\tmenuItems := []*types.MenuItem{\n\t\t{\n\t\t\tLabel:   self.c.Tr.ResetPatch,\n\t\t\tTooltip: self.c.Tr.ResetPatchTooltip,\n\t\t\tOnPress: self.c.Helpers().PatchBuilding.Reset,\n\t\t\tKeys:    menuKey('c'),\n\t\t},\n\t\t{\n\t\t\tLabel:   self.c.Tr.ApplyPatch,\n\t\t\tTooltip: self.c.Tr.ApplyPatchTooltip,\n\t\t\tOnPress: func() error { return self.handleApplyPatch(false) },\n\t\t\tKeys:    menuKey('a'),","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/controllers/custom_patch_options_menu_action.go#L4-L40","documentation":"Thrown by CustomPatchOptionsMenuAction.Call when the user opens the custom patch options menu but PatchBuilder.Active() is false, i.e. no patch has been started. The menu's operations (apply patch, reset patch, copy to clipboard, etc.) all require an in-progress patch, so lazygit tells you how to start one.","triggerScenarios":"Pressing the custom patch options key (typically '<c-p>' ctrl+p) while in the commits/commit-files view without having added any files or lines to the patch builder with 'space' or line selection.","commonSituations":"Users who expect the menu to bootstrap patch building, or who reset a patch earlier and press the menu key again out of habit.","solutions":["Select a commit file and press 'space' to add the whole file to the patch, or enter line-selection mode to add specific lines","Then reopen the custom patch options menu"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Only open the patch options menu when a patch exists:\nif !patchBuilder.Active() {\n    return errors.New(\"start a patch first: space on a commit file, or enter for specific lines\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Disable the patch-options keybinding when no patch is active","Offer a 'start patch' hint from the empty-state instead of an error","Teach users the space-on-commit-file entry point for patch building"],"tags":["lazygit","patch-building","empty-state","menu-guard"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}