jesseduffield/lazygit · error
Custom command prompt cannot have both a preset and a comman
Error message
Custom command prompt cannot have both a preset and a command for suggestions. Preset: '%s', Command: '%s'
What it means
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.
Source
Thrown at pkg/gui/services/custom_commands/handler_creator.go:166
}
self.c.Prompt(types.PromptOpts{
Title: prompt.Title,
InitialContent: prompt.InitialValue,
FindSuggestionsFunc: findSuggestionsFn,
HandleConfirm: func(str string) error {
return wrappedF(str)
},
AllowEmptyInput: true,
PreserveWhitespace: true,
})
return nil
}
func (self *HandlerCreator) generateFindSuggestionsFunc(prompt *config.CustomCommandPrompt) (func(string) []*types.Suggestion, error) {
if prompt.Suggestions.Preset != "" && prompt.Suggestions.Command != "" {
return nil, fmt.Errorf(
"Custom command prompt cannot have both a preset and a command for suggestions. Preset: '%s', Command: '%s'",
prompt.Suggestions.Preset,
prompt.Suggestions.Command,
)
} else if prompt.Suggestions.Preset != "" {
return self.getPresetSuggestionsFn(prompt.Suggestions.Preset)
} else if prompt.Suggestions.Command != "" {
return self.getCommandSuggestionsFn(prompt.Suggestions.Command)
}
return nil, nil
}
func (self *HandlerCreator) getCommandSuggestionsFn(command string) (func(string) []*types.Suggestion, error) {
lines := []*types.Suggestion{}
err := self.c.OS().Cmd.NewShell(command, self.c.UserConfig().OS.ShellFunctionsFile).RunAndProcessLines(func(line string) (bool, error) {
lines = append(lines, &types.Suggestion{Value: line, Label: line})
return false, nilView on GitHub (pinned to c477a2959b)
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
Example fix
# before
prompts:
- type: input
title: Branch
suggestions:
preset: branches
command: 'git branch --format=%(refname:short)'
# after
prompts:
- type: input
title: Branch
suggestions:
preset: branches Defensive patterns
Strategy: validation
Validate before calling
# yq check before starting lazygit yq '.customCommands[].prompts[]? | select(.suggestions.preset != null and .suggestions.command != null) | "conflict: " + .title' ~/.config/lazygit/config.yml
Prevention
- Treat suggestions.preset and suggestions.command as mutually exclusive in code review of your config
- Lint custom command prompts after every config edit
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unknown value for suggestionsPreset in custom command: %s. V
- custom command prompt must have a type of 'input', 'menu', '
- Error when setting custom command keybindings: unknown conte
- Error parsing custom command keybindings: context not provid
- You should have an allBranchesLogCmds defined as a sequence!
AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15).
Data as JSON: /api/errors/74fb01685f03a090.
Report an issue: GitHub.