argoproj/argo-workflows · error
invalid shell %q: supported shells are bash, zsh, and fish
Error message
invalid shell %q: supported shells are bash, zsh, and fish
What it means
`argo completion <shell>` looks up the shell name in a fixed map containing only bash, zsh, and fish. Any other string reaches the default path and returns this error. Note powershell completion is not offered by this command even though cobra supports it.
Source
Thrown at cmd/argo/commands/completion.go:144
For zsh, output to a file in a directory referenced by the $fpath shell
variable.
For fish, output to a file in ~/.config/fish/completions
`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
shell := args[0]
rootCommand := NewCommand()
rootCommand.BashCompletionFunction = bashCompletionFunc
availableCompletions := map[string]func(out io.Writer, cmd *cobra.Command) error{
"bash": runCompletionBash,
"zsh": runCompletionZsh,
"fish": runCompletionFish,
}
completion, ok := availableCompletions[shell]
if !ok {
return fmt.Errorf("invalid shell %q: supported shells are bash, zsh, and fish", shell)
}
return completion(os.Stdout, rootCommand)
},
}
return command
}
func runCompletionBash(out io.Writer, cmd *cobra.Command) error {
return cmd.GenBashCompletion(out)
}
func runCompletionZsh(out io.Writer, cmd *cobra.Command) error {
return cmd.GenZshCompletion(out)
}
func runCompletionFish(out io.Writer, cmd *cobra.Command) error {
return cmd.GenFishCompletion(out, true)
}View on GitHub (pinned to 35bff19146)
Solutions
- Use one of: `argo completion bash`, `argo completion zsh`, `argo completion fish`
- For PowerShell, generate bash-compatible completion is not available — use the shell's own completion for external tools or file an upstream feature request
- For POSIX sh, source bash completion under bash or use fish/zsh instead
- Check spelling and casing: the shell argument must be exactly lowercase bash/zsh/fish
Example fix
// before argo completion powershell // after argo completion bash # or zsh / fish
Defensive patterns
Strategy: validation
Validate before calling
case "$shell" in bash|zsh|fish) argo completion "$shell";; *) echo "unsupported shell: $shell (use bash|zsh|fish)" >&2; exit 1;; esac
Prevention
- Never source completion generation for shells other than bash/zsh/fish
- Guard install scripts with a shell-name check before calling `argo completion`
- Note PowerShell is unsupported — use alternative completion setups for Windows
When it happens
Trigger: Running `argo completion powershell`, `argo completion sh`, `argo completion Bash` (case-sensitive map), or `argo completion` with an empty/typo'd argument.
Common situations: Windows/PowerShell users expecting a powershell subcommand; POSIX `sh` (dash) users; scripts generating completion for a shell name held in a variable with wrong case or whitespace.
Related errors
- unknown output mode: %s
- failed to get existing cluster workflow template %q to updat
- failed to update cluster workflow template: %s, %w
- error converting %s: %w
- failed to parse TypeMeta: %w
AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03).
Data as JSON: /api/errors/7b01458728e1c486.
Report an issue: GitHub.