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

  1. Change each prompt option key to a valid lazygit key label (single characters, 'a', ctrl+x, <f1>, digits, arrows).
  2. Check the linked docs page for the exact spelling of multi-key labels.
  3. 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

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


AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15). Data as JSON: /api/errors/c2998a6891994e09. Report an issue: GitHub.