asdf-vm/asdf · error

usage: asdf shimversions <command>

Error message

usage: asdf shimversions <command>

What it means

asdf's shimversions command prints which versions a shim maps to; it requires a shim name argument. shimVersionsCommand returns this usage error when shimName is empty, because there is no shim to look up.

Source

Thrown at internal/cli/cli.go:1410

	// fast enough now.
	if tool == "" || version == "" {
		err = shims.RemoveAll(conf)
		if err != nil {
			return err
		}

		return shims.GenerateAll(conf, os.Stdout, os.Stderr)
	}

	// If provided a specific version it could be something special like a path
	// version so we need to generate it manually
	return reshimToolVersion(conf, plugin, version, os.Stdout, os.Stderr)
}

func shimVersionsCommand(logger *log.Logger, shimName string) error {
	if shimName == "" {
		logger.Printf("usage: asdf shimversions <command>")
		return fmt.Errorf("usage: asdf shimversions <command>")
	}

	conf, err := config.LoadConfig()
	if err != nil {
		logger.Printf("error loading config: %s", err)
		return err
	}

	shimPath := shims.Path(conf, shimName)
	toolVersions, err := shims.GetToolsAndVersionsFromShimFile(shimPath)
	for _, toolVersion := range toolVersions {
		for _, version := range toolVersion.Versions {
			fmt.Printf("%s %s\n", toolVersion.Name, version)
		}
	}
	return err
}

View on GitHub (pinned to 074a1722ca)

Solutions

  1. Pass the shim name: `asdf shimversions node`.
  2. List available shims under ~/.asdf/shims to pick a valid name.
  3. Guard scripts: only call `asdf shimversions $SHIM` when $SHIM is non-empty.

Example fix

// before
asdf shimversions
// after
asdf shimversions node
Defensive patterns

Strategy: validation

Validate before calling

if [ -z "$SHIM" ]; then echo "usage: asdf shimversions <command>" >&2; exit 1; fi
asdf shimversions "$SHIM"

Try / catch

if ! asdf shimversions "$SHIM" 2>err.log; then cat err.log >&2; fi

Prevention

When it happens

Trigger: Running `asdf shimversions` with no arguments, or calling shimVersionsCommand programmatically with "".

Common situations: Exploring which versions back a shim but forgetting the shim name; scripting where the shim-name variable is empty.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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