Skip to content

Improve error message for partial version strings#2099

Open
alexchenai wants to merge 1 commit intovolta-cli:mainfrom
alexchenai:fix/improve-partial-version-error-message
Open

Improve error message for partial version strings#2099
alexchenai wants to merge 1 commit intovolta-cli:mainfrom
alexchenai:fix/improve-partial-version-error-message

Conversation

@alexchenai
Copy link

Summary

  • Adds a new VersionParseErrorPartial error variant that detects when users provide partial versions like "18" or "18.4" instead of full semver versions like "18.0.0"
  • The improved error message explains that Volta requires a fully-qualified semver version and suggests using volta install or volta pin on the command line, which supports semver ranges
  • Adds an is_partial_version helper function with unit tests

Fixes #1433

Before

Volta error: Could not parse version "18"

Please verify the intended version.

After

Volta error: Could not parse version "18"

Volta requires a fully-qualified semver version (e.g. "18.0.0" instead of "18").

To install using a partial version, use `volta install node@18` or `volta pin node@18` on the command line, which supports semver ranges.

Test plan

  • Unit tests for is_partial_version cover major-only, major.minor, full semver, and non-numeric strings
  • Unit tests for VersionSpec::from_str verify partial versions still work via the semver range fallback path
  • cargo test passes

🤖 Generated with Claude Code

When users provide a partial version like "18" or "18.4" in package.json's
volta config, the error message now explains that Volta requires a
fully-qualified semver version (e.g. "18.0.0") and suggests using
`volta install` or `volta pin` on the command line for partial versions.

Fixes volta-cli#1433

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Partial versions cause hard-to-read errors

1 participant