{"record":{"id":"48c2181745312ce2","repo":"coreybutler/nvm-windows","slug":"s-is-not-a-valid-version-please-use-a-valid-se","errorCode":null,"errorMessage":"\"%s\" is not a valid version.\nPlease use a valid semantic version number, \"lts\", or \"latest\".","messagePattern":"\"(.+?)\" is not a valid version\\.\nPlease use a valid semantic version number, \"lts\", or \"latest\"\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/nvm.go","lineNumber":648,"sourceCode":"\t\t\t\t\tsverr = sv.Validate()\n\t\t\t\t}\n\t\t\t\tif sverr != nil {\n\t\t\t\t\tversion = findLatestSubVersion(version)\n\t\t\t\t\tif len(version) == 0 {\n\t\t\t\t\t\tsverr = errors.New(\"Unrecognized version: \\\"\" + requestedVersion + \"\\\"\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\terr = sverr\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\tstatus <- Status{Err: err, Help: true}\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif err != nil {\n\t\t\tstatus <- Status{Err: fmt.Errorf(`\"%s\" is not a valid version.`+\"\\n\"+`Please use a valid semantic version number, \"lts\", or \"latest\".`, requestedVersion)}\n\t\t\treturn\n\t\t}\n\n\t\tif checkVersionExceedsLatest(version) {\n\t\t\tstatus <- Status{Err: fmt.Errorf(\"Node.js v%s is not yet released or is not available for download yet.\", version)}\n\t\t\treturn\n\t\t}\n\n\t\tif cpuarch == \"64\" && !web.IsNode64bitAvailable(version) {\n\t\t\tstatus <- Status{Err: fmt.Errorf(\"Node.js v%s is only available in 32-bit.\", version)}\n\t\t\treturn\n\t\t}\n\n\t\t// Check to see if the version is already installed\n\t\tif !node.IsVersionInstalled(env.root, version, cpuarch) {\n\t\t\tif !node.IsVersionAvailable(version) {\n\t\t\t\turl := web.GetFullNodeUrl(\"index.json\")\n\t\t\t\tstatus <- Status{Err: fmt.Errorf(\"Version %s is not available.\\n\\nThe complete list of available versions can be found at %s\", version, url)}","sourceCodeStart":630,"sourceCodeEnd":666,"githubUrl":"https://github.com/coreybutler/nvm-windows/blob/5b18223ca19ff50d707f35410dbc6bd440a9f74d/src/nvm.go#L630-L666","documentation":"Sent on the install status channel when getVersion()/semver resolution left err non-nil after all rescue paths (invalid version and not a \"No Major.Minor.Patch\" case). It is the generic 'not a valid version' terminal message, echoing requestedVersion and telling the user the accepted forms: semantic version, lts, or latest.","triggerScenarios":"`nvm install 20.11` where the partial-version lookup path errored in a way other than 'No Major.Minor.Patch'; malformed input like `nvm install v20.11.0-beta` where the prerelease tag fails this build's semver handling; or an empty/garbage string that slips past earlier checks.","commonSituations":"Prerelease/tagged versions (e.g. `-nightly`, custom builds); scripts concatenating extra characters onto the version; users pasting versions from blog posts with invisible whitespace.","solutions":["Use an exact released version from `nvm ls available`, e.g. `nvm install 20.11.0`.","Use `latest` or `lts` aliases.","Strip whitespace/quotes/CR characters from scripted version strings: `nvm install $(printf '%s' \"$V\" | tr -d '[:space:]')`.","For prerelease builds, install manually by unzipping into <NVM_HOME>\\v<version>."],"exampleFix":"# before\nnvm install \" 20.11.0 \"\n# after\nnvm install 20.11.0","handlingStrategy":"validation","validationCode":"# bash: trim whitespace/CR and validate shape before install\nV=$(printf '%s' \"$NODE_VERSION\" | tr -d '[:space:]')\ncase \"$V\" in latest|lts|*[0-9].[0-9].[0-9]*) nvm install \"$V\" ;; *) echo \"bad version: $V\" >&2; exit 1 ;; esac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Strip whitespace and CR from scripted version strings (affects Windows CRLF files).","Avoid prerelease tags; nvm-windows only installs official index versions.","Validate the token shape before passing it so the CLI help path never triggers."],"tags":["nvm-windows","version-validation","install","cli"],"backgroundTag":null,"analyzedSha":"5b18223ca19ff50d707f35410dbc6bd440a9f74d","analyzedAt":"2026-08-15T10:06:51.428Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}