go-task/task · error
unknown shell: %s
Error message
unknown shell: %s
What it means
The `task --completion <shell>` command only supports a fixed set of shells (bash, zsh, fish, powershell). Passing any other value returns this error from Completion. It is a simple argument-validation error listing no supported values in the message.
Source
Thrown at completion.go:37
//go:embed completion/zsh/_task
var completionZsh string
func Completion(completion string) (string, error) {
// Get the file extension for the selected shell
switch completion {
case "bash":
return completionBash, nil
case "fish":
return completionFish, nil
case "nu", "nushell":
return completionNu, nil
case "powershell":
return completionPowershell, nil
case "zsh":
return completionZsh, nil
default:
return "", fmt.Errorf("unknown shell: %s", completion)
}
}
View on GitHub (pinned to 385e5ad92a)
Solutions
- Use one of the supported values: bash, zsh, fish, powershell (exact lowercase spelling)
- Check `task --help` for the exact completion subcommand syntax for your installed version
- For unsupported shells, generate the closest supported completion and adapt it manually
Example fix
# before task --completion sh # after task --completion bash
Defensive patterns
Strategy: validation
Validate before calling
var validShells = map[string]bool{"bash":true,"zsh":true,"fish":true,"powershell":true}
if !validShells[shell] {
return fmt.Errorf("unsupported shell %q; use bash, zsh, fish or powershell", shell)
} Try / catch
out, err := exec.Command("task", "--completion", shell).Output()
if err != nil {
// fall back to bash completion or show supported shells
} Prevention
- Whitelist shell names before invoking --completion
- Use exact lowercase names matching Task's switch cases
- Read task --help to confirm supported shells for your version
When it happens
Trigger: Running `task --completion <value>` where <value> is not exactly one of the supported shell names handled by the switch in Completion.
Common situations: Typo like `--completion bash4`, using `sh`, `fish`-variant names or capitalized values (`Bash`), or copying an example from another tool (e.g. `--completion powershell-core`).
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- task: You can't set both --download and --offline flags
- task: You can't set both --download and --clear-cache flags
- task: You can't set both --global and --dir
- task: You can't set --output-group-begin without --output=gr
- task: You can't set --output-group-end without --output=grou
AI-assisted analysis of go-task/task@385e5ad92a (2026-09-05).
Data as JSON: /api/errors/cfd6bb0d89c2b46e.
Report an issue: GitHub.