{"record":{"id":"7a45455484a035c0","repo":"jesseduffield/lazygit","slug":"error-with-custom-command-s-it-is-not-allowed-to","errorCode":null,"errorMessage":"Error with custom command%s: it is not allowed to use both commandMenu and any of the other fields except key and description.","messagePattern":"Error with custom command(.+?): it is not allowed to use both commandMenu and any of the other fields except key and description\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/user_config_validation.go","lineNumber":212,"sourceCode":"func validateCustomCommands(customCommands []CustomCommand) error {\n\tfor _, customCommand := range customCommands {\n\t\tif err := validateCustomCommandKey(customCommand.Key); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(customCommand.CommandMenu) > 0 {\n\t\t\tif len(customCommand.Context) > 0 ||\n\t\t\t\tlen(customCommand.Command) > 0 ||\n\t\t\t\tlen(customCommand.Prompts) > 0 ||\n\t\t\t\tlen(customCommand.LoadingText) > 0 ||\n\t\t\t\tlen(customCommand.Output) > 0 ||\n\t\t\t\tlen(customCommand.OutputTitle) > 0 ||\n\t\t\t\tcustomCommand.After != nil {\n\t\t\t\tcommandRef := \"\"\n\t\t\t\tif len(customCommand.Key) > 0 {\n\t\t\t\t\tcommandRef = fmt.Sprintf(\" with key '%s'\", customCommand.Key.String())\n\t\t\t\t}\n\t\t\t\treturn fmt.Errorf(\"Error with custom command%s: it is not allowed to use both commandMenu and any of the other fields except key and description.\", commandRef)\n\t\t\t}\n\n\t\t\tif err := validateCustomCommands(customCommand.CommandMenu); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tfor _, prompt := range customCommand.Prompts {\n\t\t\t\tif err := validateCustomCommandPrompt(prompt); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif err := validateEnum(\"customCommand.output\", customCommand.Output,\n\t\t\t\t[]string{\"\", \"none\", \"terminal\", \"log\", \"logWithPty\", \"popup\"}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/config/user_config_validation.go#L194-L230","documentation":"Raised by validateCustomCommands in pkg/config/user_config_validation.go. A custom command that sets commandMenu (a nested submenu) must not also set context, command, prompts, loadingText, output, outputTitle or after — only key and description are allowed alongside it. This prevents a command that is simultaneously an action and a menu.","triggerScenarios":"Writing a customCommands entry with both `commandMenu:` (non-empty list) and any of context/command/prompts/loadingText/output/outputTitle/after, then launching lazygit.","commonSituations":"Copying a working custom command and adding a submenu to it instead of starting fresh; indentation mistakes that leave the old fields at the same level as commandMenu; docs examples merged incorrectly.","solutions":["Split into two entries: keep the plain command in one and move commandMenu into its own entry (optionally with a different key/description).","Or delete the extra fields so only key, description and commandMenu remain.","Check YAML indentation — fields accidentally promoted to the parent entry look like violations.","Restart lazygit to revalidate."],"exampleFix":"# before\ncustomCommands:\n  - key: 'm'\n    description: menu\n    command: git status\n    commandMenu:\n      - key: 's'\n        command: git stash\n\n# after\ncustomCommands:\n  - key: 's'\n    command: git status\n  - key: 'm'\n    description: menu\n    commandMenu:\n      - key: 't'\n        command: git stash","handlingStrategy":"validation","validationCode":"for _, cc := range cfg.CustomCommands {\n\tif len(cc.CommandMenu) > 0 && (cc.Command != \"\" || len(cc.Prompts) > 0 || cc.Context != \"\" || cc.Output != \"\" || cc.LoadingText != \"\" || cc.OutputTitle != \"\" || cc.After != nil) {\n\t\treturn errors.New(\"commandMenu entries may only use key and description\")\n\t}\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat commandMenu entries as pure containers: only key and description.","Put executable commands in separate top-level customCommands entries.","Check indentation after YAML edits — accidental field promotion causes this error."],"tags":["config","custom-commands","command-menu"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}