pulumi/pulumi · error

parsing CLI version %q: %w

Error message

parsing CLI version %q: %w

What it means

ValidatePulumiVersionRange throws this when the running Pulumi CLI's own version string cannot be parsed by semver.ParseTolerant. Note the message quotes the parsed parameter but formats version.Version (the build-time version), which may be empty or non-semver in custom builds.

Source

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

	}, 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
}

func buildPluginArguments(opts pluginArgumentOptions) []string {
	var args []string

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Install an official Pulumi CLI release via the standard installer or package manager
  2. If building locally, set the version ldflags (e.g. make build with version variables) so version.Version is valid semver
  3. Check `pulumi version` output; if it is not a valid semver string, reinstall

Example fix

// before (local build)
go build -o pulumi ./cmd/pulumi
// after
go build -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=v3.100.0" -o pulumi ./cmd/pulumi
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the CLI version is semver-parseable before enforcing ranges
if _, err := semver.ParseTolerant(version.Version); err != nil {
	return fmt.Errorf("CLI build lacks valid version metadata: %w", err)
}

Try / catch

if err := ValidatePulumiVersionRange(rangeStr, cliVer); err != nil {
	if strings.Contains(err.Error(), "parsing CLI version") {
		// switch to an official CLI build
	}
	return err
}

Prevention

When it happens

Trigger: A plugin declares a pulumiVersionRange and cliVersion is non-empty, but semver.ParseTolerant(cliVersion) fails — typically when the CLI was built without proper version ldflags (version like 'dev' or empty) or a corrupted version string.

Common situations: Running a locally built pulumi binary without --ldflags version injection; a nightly/custom build whose version is not semver-shaped; mismatched version metadata.

Related errors


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