jesseduffield/lazygit · error
Unrecognized key '%s' for custom command prompt option. For
Error message
Unrecognized key '%s' for custom command prompt option. For permitted values see %s
What it means
Raised by validateCustomCommandPrompt in pkg/config/user_config_validation.go. For each option of every prompt in a custom command's `prompts` list, the option's Key binding elements are checked with isValidKeybindingKey; unrecognized key labels are rejected with a link to the keybindings docs.
Source
Thrown at pkg/config/user_config_validation.go:238
if err := validateCustomCommandPrompt(prompt); err != nil {
return err
}
}
if err := validateEnum("customCommand.output", customCommand.Output,
[]string{"", "none", "terminal", "log", "logWithPty", "popup"}); err != nil {
return err
}
}
}
return nil
}
func validateCustomCommandPrompt(prompt CustomCommandPrompt) error {
for _, option := range prompt.Options {
for _, k := range option.Key {
if !isValidKeybindingKey(k) {
return fmt.Errorf("Unrecognized key '%s' for custom command prompt option. For permitted values see %s",
k, constants.Links.Docs.CustomKeybindings)
}
}
}
return nil
}
View on GitHub (pinned to c477a2959b)
Solutions
- Change each prompt option key to a valid lazygit key label (single characters, 'a', ctrl+x, <f1>, digits, arrows).
- Check the linked docs page for the exact spelling of multi-key labels.
- Re-run lazygit to confirm validation passes.
Example fix
# before
customCommands:
- key: 'p'
command: echo {{.prompt.choice}}
prompts:
- type: menu
key: Choice
options:
- key: option-one
value: one
# after
customCommands:
- key: 'p'
command: echo {{.prompt.choice}}
prompts:
- type: menu
key: Choice
options:
- key: '1'
value: one Defensive patterns
Strategy: validation
Validate before calling
for _, cc := range cfg.CustomCommands {
for _, p := range cc.Prompts {
for _, opt := range p.Options {
for _, k := range opt.Key {
if !validKeyRe.MatchString(k) {
return fmt.Errorf("prompt option key %q invalid", k)
}
}
}
}
} Prevention
- Use single characters or canonical labels for prompt option keys.
- Remember prompt options share the global key-label table — no free-form mnemonics.
When it happens
Trigger: Declaring a custom command prompt with options whose key uses invalid notation, e.g. `prompts: [{type: menu, options: [{key: opt1, ...}]}]` where 'opt1' is not a valid key label — validated at startup.
Common situations: Users using short menu mnemonics ('y', '1') which can be valid, but writing things like 'option-one', 'F1', or 'ctrlX' which are not; forgetting that prompt option keys use the same key-label table as global keybindings.
Related errors
- Unrecognized key '%s' for custom command. For permitted valu
- custom command prompt must have a type of 'input', 'menu', '
- unable to parse filter regex, error: {{err}}
- unable to parse value format, error: {{err}}
- unable to parse label format, error: {{err}}
AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15).
Data as JSON: /api/errors/c2998a6891994e09.
Report an issue: GitHub.