coreybutler/nvm-windows · error

Unrecognized version: "%s"

Error message

Unrecognized version: "%s"

What it means

Returned by getVersion() when the input could not be coerced into a concrete x.y.z version: the semver machinery reported "No Major.Minor.Patch" and a follow-up findLatestSubVersion(version, localOnly) lookup (against the index of available/installed versions) also produced an empty string. It reports the user's original requestedVersion, not the mangled one.

Source

Thrown at src/nvm.go:392

	if err == nil {
		// if the user specifies only the major/minor version, identify the latest
		// version applicable to what was provided.
		sv := strings.Split(version, ".")
		if len(sv) < 3 {
			version = findLatestSubVersion(version)
		} else {
			version = cleanVersion(version)
		}

		version = versionNumberFrom(version)
	} else if strings.Contains(err.Error(), "No Major.Minor.Patch") {
		latestLocalInstall := false
		if len(localInstallsOnly) > 0 {
			latestLocalInstall = localInstallsOnly[0]
		}
		version = findLatestSubVersion(version, latestLocalInstall)
		if len(version) == 0 {
			err = errors.New("Unrecognized version: \"" + requestedVersion + "\"")
		}
	}

	return version, cpuarch, err
}

type Status struct {
	Text string
	Err  error
	Done bool
	Help bool
}

func rollback(version string) error {
	p := filepath.Join(env.root, "v"+version)

	_, err := os.Lstat(p)
	if err != nil {

View on GitHub (pinned to 5b18223ca1)

Solutions

  1. Pass a full semantic version, e.g. `nvm install 20.11.0` (leading 'v' is tolerated by versionNumberFrom, but full x.y.z is safest).
  2. Use aliases latest/lts/newest instead of hand-typed partial versions.
  3. If offline, install a version that is already cached locally or check connectivity, since sub-version resolution needs the index.
  4. Run `nvm ls available` to see valid version identifiers.

Example fix

# before
nvm install 2O.11.0
# after
nvm install 20.11.0
Defensive patterns

Strategy: validation

Validate before calling

# bash: validate the version token before invoking nvm
if ! printf '%s' "$V" | grep -qE '^v?[0-9]+(\.[0-9]+){0,2}$'; then
  echo "not a semantic version: $V" >&2; exit 1
fi
nvm install "$V"

Prevention

When it happens

Trigger: Passing something that is neither a semantic version, a known alias, nor a resolvable major.minor stream — e.g. `nvm install 2O.11.0` (typo with letter O), `nvm install v20` where 20 is not a resolvable stream, or `nvm install ""` variants that slip past earlier checks. Also `nvm install 4.0` when offline and only local lookups are possible (localInstallsOnly=true finds no match).

Common situations: Copy-pasting version strings with unicode digits or a leading 'v' plus partial version; offline machines where findLatestSubVersion cannot consult the remote index; version streams that never existed (e.g. `nvm install 99`).

Related errors


AI-assisted analysis of coreybutler/nvm-windows@5b18223ca1 (2026-08-15). Data as JSON: /api/errors/8ee1fa26c7736772. Report an issue: GitHub.