{"record":{"id":"74fb01685f03a090","repo":"jesseduffield/lazygit","slug":"custom-command-prompt-cannot-have-both-a-preset-an","errorCode":null,"errorMessage":"Custom command prompt cannot have both a preset and a command for suggestions. Preset: '%s', Command: '%s'","messagePattern":"Custom command prompt cannot have both a preset and a command for suggestions\\. Preset: '(.+?)', Command: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gui/services/custom_commands/handler_creator.go","lineNumber":166,"sourceCode":"\t}\n\n\tself.c.Prompt(types.PromptOpts{\n\t\tTitle:               prompt.Title,\n\t\tInitialContent:      prompt.InitialValue,\n\t\tFindSuggestionsFunc: findSuggestionsFn,\n\t\tHandleConfirm: func(str string) error {\n\t\t\treturn wrappedF(str)\n\t\t},\n\t\tAllowEmptyInput:    true,\n\t\tPreserveWhitespace: true,\n\t})\n\n\treturn nil\n}\n\nfunc (self *HandlerCreator) generateFindSuggestionsFunc(prompt *config.CustomCommandPrompt) (func(string) []*types.Suggestion, error) {\n\tif prompt.Suggestions.Preset != \"\" && prompt.Suggestions.Command != \"\" {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"Custom command prompt cannot have both a preset and a command for suggestions. Preset: '%s', Command: '%s'\",\n\t\t\tprompt.Suggestions.Preset,\n\t\t\tprompt.Suggestions.Command,\n\t\t)\n\t} else if prompt.Suggestions.Preset != \"\" {\n\t\treturn self.getPresetSuggestionsFn(prompt.Suggestions.Preset)\n\t} else if prompt.Suggestions.Command != \"\" {\n\t\treturn self.getCommandSuggestionsFn(prompt.Suggestions.Command)\n\t}\n\n\treturn nil, nil\n}\n\nfunc (self *HandlerCreator) getCommandSuggestionsFn(command string) (func(string) []*types.Suggestion, error) {\n\tlines := []*types.Suggestion{}\n\terr := self.c.OS().Cmd.NewShell(command, self.c.UserConfig().OS.ShellFunctionsFile).RunAndProcessLines(func(line string) (bool, error) {\n\t\tlines = append(lines, &types.Suggestion{Value: line, Label: line})\n\t\treturn false, nil","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/services/custom_commands/handler_creator.go#L148-L184","documentation":"Thrown by HandlerCreator.generateFindSuggestionsFunc when a custom command's input prompt in the user's config defines BOTH 'suggestions.preset' and 'suggestions.command'. lazygit cannot decide which suggestion source to use, so it rejects the prompt at load time instead of silently picking one.","triggerScenarios":"A customCommands entry with a prompt block containing both keys, e.g. { type: 'input', title: 'Branch', suggestions: { preset: 'branches', command: 'git branch --format=%(refname:short)' } }. Any such entry causes this error when lazygit builds custom command handlers on startup.","commonSituations":"Copy-pasting a custom command from documentation and adding a preset while the original already had a command; refactoring a prompt from command-based to preset-based suggestions and forgetting to delete the old key.","solutions":["Open the config file and delete either 'preset' or 'command' from the prompt's suggestions block","Keep 'preset' for built-in sources (files, branches, remotes, remoteBranches, refs, tags) or 'command' for a shell command emitting one suggestion per line — never both"],"exampleFix":"# before\nprompts:\n  - type: input\n    title: Branch\n    suggestions:\n      preset: branches\n      command: 'git branch --format=%(refname:short)'\n\n# after\nprompts:\n  - type: input\n    title: Branch\n    suggestions:\n      preset: branches","handlingStrategy":"validation","validationCode":"# yq check before starting lazygit\nyq '.customCommands[].prompts[]? | select(.suggestions.preset != null and .suggestions.command != null) | \"conflict: \" + .title' ~/.config/lazygit/config.yml","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat suggestions.preset and suggestions.command as mutually exclusive in code review of your config","Lint custom command prompts after every config edit"],"tags":["lazygit","custom-commands","config","suggestions","yaml"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}