jesseduffield/lazygit · error
Unknown value for suggestionsPreset in custom command: %s. V
Error message
Unknown value for suggestionsPreset in custom command: %s. Valid values: files, branches, remotes, remoteBranches, refs
What it means
Thrown by HandlerCreator.getPresetSuggestionsFn when a prompt's 'suggestions.preset' value does not match any case in its switch. Note the error text lists 'files, branches, remotes, remoteBranches, refs' but the switch also accepts 'tags' — the message is slightly stale; in practice valid values are files, branches, remotes, remoteBranches, refs, tags.
Source
Thrown at pkg/gui/services/custom_commands/handler_creator.go:214
func (self *HandlerCreator) getPresetSuggestionsFn(preset string) (func(string) []*types.Suggestion, error) {
switch preset {
case "authors":
return self.suggestionsHelper.GetAuthorsSuggestionsFunc(), nil
case "branches":
return self.suggestionsHelper.GetBranchNameSuggestionsFunc(), nil
case "files":
return self.suggestionsHelper.GetFilePathSuggestionsFunc(), nil
case "refs":
return self.suggestionsHelper.GetRefsSuggestionsFunc(), nil
case "remotes":
return self.suggestionsHelper.GetRemoteSuggestionsFunc(), nil
case "remoteBranches":
return self.suggestionsHelper.GetRemoteBranchesSuggestionsFunc("/"), nil
case "tags":
return self.suggestionsHelper.GetTagsSuggestionsFunc(), nil
default:
return nil, fmt.Errorf("Unknown value for suggestionsPreset in custom command: %s. Valid values: files, branches, remotes, remoteBranches, refs", preset)
}
}
func (self *HandlerCreator) confirmPrompt(prompt *config.CustomCommandPrompt, handleConfirm func() error) error {
self.c.Confirm(types.ConfirmOpts{
Title: prompt.Title,
Prompt: prompt.Body,
HandleConfirm: handleConfirm,
})
return nil
}
func (self *HandlerCreator) menuPrompt(prompt *config.CustomCommandPrompt, wrappedF func(string) error) error {
menuItems := lo.Map(prompt.Options, func(option config.CustomCommandMenuOption, _ int) *types.MenuItem {
return &types.MenuItem{
LabelColumns: []string{option.Name, style.FgYellow.Sprint(option.Description)},
OnPress: func() error {View on GitHub (pinned to c477a2959b)
Solutions
- Correct the preset to one of: files, branches, remotes, remoteBranches, refs, tags
- If you need a source not in the list (e.g. authors, commits), switch to suggestions.command with a shell command that prints candidates
Example fix
# before suggestions: preset: file # after suggestions: preset: files
Defensive patterns
Strategy: validation
Validate before calling
# yq check against the full valid set (note: 'tags' is valid even though the error text omits it) yq '.customCommands[].prompts[].suggestions.preset? | select(. != "files" and . != "branches" and . != "remotes" and . != "remoteBranches" and . != "refs" and . != "tags")' ~/.config/lazygit/config.yml
Prevention
- Copy preset names verbatim from the version-matched docs, not from memory
- If a source isn't in the list, use suggestions.command with a shell command instead
When it happens
Trigger: Setting suggestions.preset to a typo or unsupported name: 'file' instead of 'files', 'Branches' (capitalized), 'localBranches', or 'commits'. Any string outside the switch cases hits default and return this error.
Common situations: Typos in hand-written config; using a preset name from a newer/older lazygit version than the docs being read; guessing a plausible name like 'tags' on a version whose message omits it (tags actually works) or 'authors' (does not exist).
Related errors
- Custom command prompt cannot have both a preset and a comman
- Error when setting custom command keybindings: unknown conte
- Error parsing custom command keybindings: context not provid
- No config file found
- custom command prompt must have a type of 'input', 'menu', '
AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15).
Data as JSON: /api/errors/55ecd65132c11be4.
Report an issue: GitHub.