{"record":{"id":"29a68969eeced977","repo":"jesseduffield/lazygit","slug":"custom-command-prompt-must-have-a-type-of-input","errorCode":null,"errorMessage":"custom command prompt must have a type of 'input', 'menu', 'menuFromCommand', or 'confirm'","messagePattern":"custom command prompt must have a type of 'input', 'menu', 'menuFromCommand', or 'confirm'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gui/services/custom_commands/handler_creator.go","lineNumber":107,"sourceCode":"\t\t\t\t}\n\t\t\tcase \"menuFromCommand\":\n\t\t\t\tf = func() error {\n\t\t\t\t\tresolvedPrompt, err := self.resolver.resolvePrompt(&prompt, resolveTemplate)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\treturn self.menuPromptFromCommand(resolvedPrompt, wrappedF)\n\t\t\t\t}\n\t\t\tcase \"confirm\":\n\t\t\t\tf = func() error {\n\t\t\t\t\tresolvedPrompt, err := self.resolver.resolvePrompt(&prompt, resolveTemplate)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\treturn self.confirmPrompt(resolvedPrompt, g)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn errors.New(\"custom command prompt must have a type of 'input', 'menu', 'menuFromCommand', or 'confirm'\")\n\t\t\t}\n\n\t\t\tif prompt.Condition != \"\" {\n\t\t\t\tshowPrompt := f\n\t\t\t\tconditionTemplate := prompt.Condition\n\t\t\t\tf = func() error {\n\t\t\t\t\tresolved, err := resolveCondition(conditionTemplate, resolveTemplate)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tif resolved {\n\t\t\t\t\t\treturn showPrompt()\n\t\t\t\t\t}\n\t\t\t\t\tif _, exists := form[prompt.Key]; !exists {\n\t\t\t\t\t\tform[prompt.Key] = \"\"\n\t\t\t\t\t}\n\t\t\t\t\treturn g()\n\t\t\t\t}","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/services/custom_commands/handler_creator.go#L89-L125","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open your config.yml, find the custom command whose prompt has the bad type, and set type to exactly 'input', 'menu', 'menuFromCommand', or 'confirm'.","Reload the config (restart lazygit or use the reload-keybinding) and re-run the command.","Validate the rest of the prompts array for the same mistake — only the first bad one reports."],"exampleFix":"# before\ncustomCommands:\n  - key: 'b'\n    command: 'echo {{.Prompt}}'\n    prompts:\n      - type: 'text'   # unsupported\n        title: 'branch name'\n# after\ncustomCommands:\n  - key: 'b'\n    command: 'echo {{.Prompt}}'\n    prompts:\n      - type: 'input'\n        title: 'branch name'","handlingStrategy":"validation","validationCode":"import \"slices\"\n\nvar validPromptTypes = []string{\"input\", \"menu\", \"menuFromCommand\", \"confirm\"}\n\nfunc validatePrompts(prompts []CustomCommandPrompt) error {\n    for _, p := range prompts {\n        if !slices.Contains(validPromptTypes, p.Type) {\n            return fmt.Errorf(\"prompt type %q invalid; want one of %v\", p.Type, validPromptTypes)\n        }\n    }\n    return nil\n}","typeGuard":"func isValidPromptType(t string) bool {\n    switch t {\n    case \"input\", \"menu\", \"menuFromCommand\", \"confirm\":\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Lint custom-commands config on startup instead of failing at keypress time.","Copy prompt examples from the current release's docs, not old blog posts.","After upgrading lazygit, re-check customCommands in config.yml against the changelog."],"tags":["config","yaml","custom-commands","validation"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}