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

  1. Run `asdf completion` (or read the error message) to list supported shell names and use exactly one of them
  2. Check the exact shell name: use `zsh`/`bash`/`fish` as asdf spells them, not `zsh-5.9` etc.
  3. 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

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


AI-assisted analysis of asdf-vm/asdf@074a1722ca (2026-08-30). Data as JSON: /api/errors/6e649d34a55b4fc4. Report an issue: GitHub.