asdf-vm/asdf · error
bad shell name
Error message
bad shell name
What it means
`asdf completion <shell>` only ships prebuilt completion scripts for a fixed set of shells. If the shell name is not a key in the completions map, it prints the supported names and returns this error.
Source
Thrown at internal/cli/cli.go:378
},
}
err := unsetAsdfReservedEnvVars()
if err != nil {
cli.OsExiter(1)
}
if err = app.Run(context.Background(), os.Args); err != nil {
cli.OsExiter(1)
}
}
func completionCommand(l *log.Logger, shell string) error {
file, ok := completions.Get(shell)
if !ok {
l.Printf(`No completions available for shell with name %q
Completions are available for: %v`, shell, strings.Join(completions.Names(), ", "))
return errors.New("bad shell name")
}
defer file.Close()
io.Copy(os.Stdout, file)
return nil
}
// This function is a whole mess and needs to be refactored
func currentCommand(logger *log.Logger, tool string, noHeader bool) error {
conf, err := config.LoadConfig()
if err != nil {
logger.Printf("error loading config: %s", err)
return err
}
currentDir, err := os.Getwd()
if err != nil {View on GitHub (pinned to 074a1722ca)
Solutions
- Run `asdf completion` (or read the error message) to list supported shell names and use exactly one of them
- Check the exact shell name: use `zsh`/`bash`/`fish` as asdf spells them, not `zsh-5.9` etc.
- Generate completions manually from your shell framework if your shell is unsupported
Example fix
// before $ asdf completion zce // after $ asdf completion zsh
Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED="bash zsh fish" # check against `asdf completion` output if ! echo "$SUPPORTED" | grep -qw "$SHELL_NAME"; then echo "unsupported shell: $SHELL_NAME" >&2 exit 1 fi
Try / catch
completions=$(asdf completion "$SHELL" 2>&1) || {
echo "completion failed: $completions" >&2
} Prevention
- Use canonical shell names (bash, zsh, fish) exactly as listed
- Capture the supported-names list from the error output before generating completions
- Test completion setup per-machine since bundled shells vary by asdf version
When it happens
Trigger: Calling `asdf completion <name>` with a name not in completions.Get, e.g. misspelled ('zsh ' trailing space, 'fish' when only bash/zsh are bundled) or an unsupported shell.
Common situations: Users setting up tab completion for a new shell, dotfiles installers referencing a shell name that differs from what asdf registers, copy-pasting completion setup from docs for a different asdf version.
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
- command removed
- no plugin name specified
- must provide command
- command not found
- no executable for tool version
AI-assisted analysis of asdf-vm/asdf@074a1722ca (2026-08-30).
Data as JSON: /api/errors/6e649d34a55b4fc4.
Report an issue: GitHub.