jesseduffield/lazygit · error

custom command prompt must have a type of 'input', 'menu', '

Error message

custom command prompt must have a type of 'input', 'menu', 'menuFromCommand', or 'confirm'

What it means

handler_creator.go validates each 'prompts' entry of a user-defined custom command in config.yml. When a prompt's `type` field is not one of the four supported strings ('input', 'menu', 'menuFromCommand', 'confirm'), the switch falls through to default and this error is returned. The whole custom command fails to run.

Source

Thrown at pkg/gui/services/custom_commands/handler_creator.go:107

				}
			case "menuFromCommand":
				f = func() error {
					resolvedPrompt, err := self.resolver.resolvePrompt(&prompt, resolveTemplate)
					if err != nil {
						return err
					}
					return self.menuPromptFromCommand(resolvedPrompt, wrappedF)
				}
			case "confirm":
				f = func() error {
					resolvedPrompt, err := self.resolver.resolvePrompt(&prompt, resolveTemplate)
					if err != nil {
						return err
					}
					return self.confirmPrompt(resolvedPrompt, g)
				}
			default:
				return errors.New("custom command prompt must have a type of 'input', 'menu', 'menuFromCommand', or 'confirm'")
			}

			if prompt.Condition != "" {
				showPrompt := f
				conditionTemplate := prompt.Condition
				f = func() error {
					resolved, err := resolveCondition(conditionTemplate, resolveTemplate)
					if err != nil {
						return err
					}
					if resolved {
						return showPrompt()
					}
					if _, exists := form[prompt.Key]; !exists {
						form[prompt.Key] = ""
					}
					return g()
				}

View on GitHub (pinned to c477a2959b)

Solutions

  1. Open your config.yml, find the custom command whose prompt has the bad type, and set type to exactly 'input', 'menu', 'menuFromCommand', or 'confirm'.
  2. Reload the config (restart lazygit or use the reload-keybinding) and re-run the command.
  3. Validate the rest of the prompts array for the same mistake — only the first bad one reports.

Example fix

# before
customCommands:
  - key: 'b'
    command: 'echo {{.Prompt}}'
    prompts:
      - type: 'text'   # unsupported
        title: 'branch name'
# after
customCommands:
  - key: 'b'
    command: 'echo {{.Prompt}}'
    prompts:
      - type: 'input'
        title: 'branch name'
Defensive patterns

Strategy: validation

Validate before calling

import "slices"

var validPromptTypes = []string{"input", "menu", "menuFromCommand", "confirm"}

func validatePrompts(prompts []CustomCommandPrompt) error {
    for _, p := range prompts {
        if !slices.Contains(validPromptTypes, p.Type) {
            return fmt.Errorf("prompt type %q invalid; want one of %v", p.Type, validPromptTypes)
        }
    }
    return nil
}

Type guard

func isValidPromptType(t string) bool {
    switch t {
    case "input", "menu", "menuFromCommand", "confirm":
        return true
    }
    return false
}

Prevention

When it happens

Trigger: Defining a custom command with customCommands.prompts[].type set to an unsupported or misspelled value such as 'Input', 'select', 'confirmation', or omitting/renaming the field in a way that yields an unexpected string.

Common situations: Hand-editing config.yml and misspelling the type; upgrading lazygit after prompt types changed; copying an example from outdated documentation or another user's config.

Related errors


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