{"record":{"id":"030a742c316a099b","repo":"GoogleContainerTools/skaffold","slug":"missing-shell-s","errorCode":null,"errorMessage":"missing shell: %s","messagePattern":"missing shell: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/skaffold/app/cmd/completion.go","lineNumber":70,"sourceCode":"\nfunc completion(cmd *cobra.Command, args []string) {\n\tswitch args[0] {\n\tcase \"bash\":\n\t\trootCmd(cmd).GenBashCompletion(os.Stdout)\n\tcase \"fish\":\n\t\trootCmd(cmd).GenFishCompletion(os.Stdout, true)\n\tcase \"zsh\":\n\t\trunCompletionZsh(cmd, os.Stdout)\n\t}\n}\n\n// NewCmdCompletion returns the cobra command that outputs shell completion code\nfunc NewCmdCompletion() *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"completion SHELL\",\n\t\tArgs: func(cmd *cobra.Command, args []string) error {\n\t\t\tif len(args) != 1 {\n\t\t\t\treturn fmt.Errorf(\"missing shell: %s\", strings.Join(cmd.ValidArgs, \", \"))\n\t\t\t}\n\t\t\treturn cobra.OnlyValidArgs(cmd, args)\n\t\t},\n\t\tValidArgs: []string{\"bash\", \"fish\", \"zsh\"},\n\t\tShort:     \"Output shell completion for the given shell (bash, fish or zsh)\",\n\t\tLong:      longDescription,\n\t\tRun:       completion,\n\t}\n}\n\nfunc runCompletionZsh(cmd *cobra.Command, out io.Writer) {\n\trootCmd(cmd).GenZshCompletion(out)\n\tio.WriteString(out, zshCompdef)\n}\n\nfunc rootCmd(cmd *cobra.Command) *cobra.Command {\n\tparent := cmd\n\tfor parent.HasParent() {","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/cmd/skaffold/app/cmd/completion.go#L52-L88","documentation":"In `skaffold completion` (cmd/skaffold/app/cmd/completion.go:70), the cobra Args validator requires exactly one argument naming a shell. When zero or multiple arguments are given, this error is returned listing the valid shells (bash, fish, zsh) before cobra's OnlyValidArgs check runs.","triggerScenarios":"Running `skaffold completion` with no argument, or with more than one argument (e.g. `skaffold completion bash zsh`); len(args) != 1 triggers the error message joined from cmd.ValidArgs.","commonSituations":"Older documentation or muscle memory from tools whose completion command takes no argument; shell alias dropping the argument; copy-pasting a command with an extra token; expecting powershell support which is not in ValidArgs.","solutions":["Pass exactly one supported shell: `skaffold completion bash` (or fish, zsh)","Fix aliases/scripts that invoke completion without the shell argument","Source the output, e.g. `source <(skaffold completion bash)` in your shell rc","Check `skaffold completion --help` for the shells supported by your skaffold version"],"exampleFix":"// before\n// skaffold completion        # missing shell\n// after\n// skaffold completion bash | source /dev/stdin   # or add to ~/.bashrc","handlingStrategy":"validation","validationCode":"// Validate the shell argument before invoking completion\nvalidShells := map[string]bool{\"bash\": true, \"fish\": true, \"zsh\": true}\nif !validShells[shell] {\n    return fmt.Errorf(\"unsupported shell %q; use bash, fish or zsh\", shell)\n}","typeGuard":"func isSupportedShell(s string) bool {\n    switch s {\n    case \"bash\", \"fish\", \"zsh\":\n        return true\n    }\n    return false\n}","tryCatchPattern":"if err := sh.Run(\"skaffold\", \"completion\", shell); err != nil {\n    if strings.Contains(err.Error(), \"missing shell\") {\n        log.Fatalf(\"pass exactly one shell: skaffold completion <bash|fish|zsh>\")\n    }\n    return err\n}","preventionTips":["Always pass exactly one shell argument to `skaffold completion`","Check --help for supported shells on your skaffold version","Guard shell rc setup scripts with an argument check","Remember powershell is not supported here; use bash/zsh/fish only"],"tags":["cli","completion","arguments","shell"],"backgroundTag":"missing-required-argument","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}