cilium/cilium · warning
too many arguments; expected only the shell type: %s
Error message
too many arguments; expected only the shell type: %s
What it means
The `hubble-relay completion` command accepts at most one argument (the shell name: bash or zsh). runCompletion returns this error when more than one positional argument is supplied. The extra arguments are echoed back in the message.
Source
Thrown at hubble-relay/cmd/completion/completion.go:29
)
// New creates a new shell completion command.
func New() *cobra.Command {
return &cobra.Command{
Use: "completion [shell]",
Short: "Output shell completion code",
Long: "Output shell completion code for bash and zsh",
Example: completionExample,
RunE: func(cmd *cobra.Command, args []string) error {
return runCompletion(cmd.OutOrStdout(), cmd, args)
},
ValidArgs: []string{"bash", "zsh"},
}
}
func runCompletion(out io.Writer, cmd *cobra.Command, args []string) error {
if len(args) > 1 {
return fmt.Errorf("too many arguments; expected only the shell type: %s", args)
}
if len(args) == 0 || args[0] == "bash" {
return cmd.Root().GenBashCompletion(out)
}
if args[0] == "zsh" {
return cmd.Root().GenZshCompletion(out)
}
return fmt.Errorf("unsupported shell: %s", args[0])
}
const completionExample = `
# Installing bash completion on macOS using homebrew
## If running Bash 3.2 included with macOS
brew install bash-completion
## or, if running Bash 4.1+
brew install bash-completion@2
## afterwards you only need to runView on GitHub (pinned to ac7b90affa)
Solutions
- Pass exactly one shell argument: `hubble-relay completion bash` or `hubble-relay completion zsh`.
- Check your install script for stray/unquoted variable expansions producing extra words.
- Run `hubble-relay completion --help` to see the accepted arguments.
Example fix
// before hubble-relay completion bash zsh > /dev/null // after hubble-relay completion bash > /etc/bash_completion.d/hubble-relay
Defensive patterns
Strategy: validation
Validate before calling
// Validate CLI args before invoking
shells := []string{"bash", "zsh"}
if len(args) != 1 || !slices.Contains(shells, args[0]) {
return fmt.Errorf("usage: hubble-relay completion [bash|zsh]")
} Try / catch
out, err := exec.Command("hubble-relay", "completion", shell).CombinedOutput()
if err != nil && strings.Contains(err.Error(), "too many arguments") {
log.Fatalf("install script bug: pass exactly one shell: %v", err)
} Prevention
- Quote shell variables in install scripts to avoid word-splitting extras
- Document the exact completion invocation in your setup tooling
- Check `hubble-relay completion --help` before scripting
When it happens
Trigger: Running `hubble-relay completion bash zsh`, `completion zsh extra`, or any invocation with two or more positional arguments after the completion subcommand.
Common situations: Typo or copy-paste of shell names together ('completion bash zsh'), scripted installation lines accidentally appending extra words, or assuming the command takes flags for shell selection.
Related errors
- missing vrouter ASN value
- invalid vrouter ASN: %w
- missing `%s` argument
- missing peer IP address
- invalid peer IP address: %w
AI-assisted analysis of cilium/cilium@ac7b90affa (2026-08-31).
Data as JSON: /api/errors/4f6d3fd8fb2d3257.
Report an issue: GitHub.