pulumi/pulumi · error

parsing CLI version range %q: %w

Error message

parsing CLI version range %q: %w

What it means

ValidatePulumiVersionRange throws this when the plugin's declared Pulumi CLI version range string cannot be parsed by Masterminds/semver ParseRange. The invalid range string and the underlying semver parse error are wrapped via %w.

Source

Thrown at sdk/go/common/resource/plugin/plugin.go:707

				}
			}
			return 0, err
		},
	}, nil
}

// ValidatePulumiVersionRange validates that the CLI version satisfies the passed version range. The supported syntax
// for ranges is that of https://pkg.go.dev/github.com/blang/semver#ParseRange. For example ">=3.0.0", or "!3.1.2".
// Ranges can be AND-ed together by concatenating with spaces ">=3.5.0 !3.7.7", meaning greater-or-equal to 3.5.0 and
// not exactly 3.7.7. Ranges can be OR-ed with the `||` operator: "<3.4.0 || >3.8.0", meaning less-than 3.4.0 or
// greater-than 3.8.0.
func ValidatePulumiVersionRange(pulumiVersionRange, cliVersion string) error {
	// The cliVersion is the build version and will usually be set when running the Pulumi CLI, however it may be empty
	// when running non-integration tests.
	if pulumiVersionRange != "" && cliVersion != "" {
		rg, err := semver.ParseRange(pulumiVersionRange)
		if err != nil {
			return fmt.Errorf("parsing CLI version range %q: %w", pulumiVersionRange, err)
		}
		cliVersion, err := semver.ParseTolerant(cliVersion)
		if err != nil {
			return fmt.Errorf("parsing CLI version %q: %w", version.Version, err)
		}
		if !rg(cliVersion) {
			return fmt.Errorf(
				"Pulumi CLI version %s does not satisfy the version range %q", cliVersion, pulumiVersionRange)
		}
	}
	return nil
}

type pluginArgumentOptions struct {
	pluginArgs           []string
	tracingEndpoint      string
	logFlow, logToStderr bool
	verbose              int

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Fix the version range string in the provider's build configuration to valid semver range syntax (e.g. '>=3.0.0 <5.0.0')
  2. Rebuild/reinstall the provider plugin after correcting the range
  3. Report a bug to the provider maintainer if the range is embedded in a released plugin

Example fix

// before (provider Makefile)
PROVIDER_VERSION_STRING = >=1.0
// after
PROVIDER_VERSION_STRING = >=1.0.0
Defensive patterns

Strategy: validation

Validate before calling

// Validate the range parses before wiring it into a provider build
import "github.com/Masterminds/semver/v3"
if _, err := semver.ParseRange(rangeStr); err != nil {
	return fmt.Errorf("invalid range %q: %w", rangeStr, err)
}

Try / catch

if err := ValidatePulumiVersionRange(rangeStr, cliVer); err != nil {
	if strings.Contains(err.Error(), "parsing CLI version range") {
		// fix the range string in the provider build config
	}
	return err
}

Prevention

When it happens

Trigger: A plugin or provider declares pulumiVersionRange (via its Makefile/provider_version flags) and semver.ParseRange fails on malformed syntax such as '>=1.0' without patch or garbage text.

Common situations: Third-party providers built with a typo in the version range; building a provider with an unsupported range expression (e.g. ranges that don't conform to Masterminds semver syntax).

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/b9000c3443464b7e. Report an issue: GitHub.