{"record":{"id":"b9000c3443464b7e","repo":"pulumi/pulumi","slug":"parsing-cli-version-range-q-w-b9000c","errorCode":null,"errorMessage":"parsing CLI version range %q: %w","messagePattern":"parsing CLI version range %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/go/common/resource/plugin/plugin.go","lineNumber":707,"sourceCode":"\t\t\t\t}\n\t\t\t}\n\t\t\treturn 0, err\n\t\t},\n\t}, nil\n}\n\n// ValidatePulumiVersionRange validates that the CLI version satisfies the passed version range. The supported syntax\n// for ranges is that of https://pkg.go.dev/github.com/blang/semver#ParseRange. For example \">=3.0.0\", or \"!3.1.2\".\n// 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\n// 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\n// greater-than 3.8.0.\nfunc ValidatePulumiVersionRange(pulumiVersionRange, cliVersion string) error {\n\t// The cliVersion is the build version and will usually be set when running the Pulumi CLI, however it may be empty\n\t// when running non-integration tests.\n\tif pulumiVersionRange != \"\" && cliVersion != \"\" {\n\t\trg, err := semver.ParseRange(pulumiVersionRange)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"parsing CLI version range %q: %w\", pulumiVersionRange, err)\n\t\t}\n\t\tcliVersion, err := semver.ParseTolerant(cliVersion)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"parsing CLI version %q: %w\", version.Version, err)\n\t\t}\n\t\tif !rg(cliVersion) {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"Pulumi CLI version %s does not satisfy the version range %q\", cliVersion, pulumiVersionRange)\n\t\t}\n\t}\n\treturn nil\n}\n\ntype pluginArgumentOptions struct {\n\tpluginArgs           []string\n\ttracingEndpoint      string\n\tlogFlow, logToStderr bool\n\tverbose              int","sourceCodeStart":689,"sourceCodeEnd":725,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/go/common/resource/plugin/plugin.go#L689-L725","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Fix the version range string in the provider's build configuration to valid semver range syntax (e.g. '>=3.0.0 <5.0.0')","Rebuild/reinstall the provider plugin after correcting the range","Report a bug to the provider maintainer if the range is embedded in a released plugin"],"exampleFix":"// before (provider Makefile)\nPROVIDER_VERSION_STRING = >=1.0\n// after\nPROVIDER_VERSION_STRING = >=1.0.0","handlingStrategy":"validation","validationCode":"// Validate the range parses before wiring it into a provider build\nimport \"github.com/Masterminds/semver/v3\"\nif _, err := semver.ParseRange(rangeStr); err != nil {\n\treturn fmt.Errorf(\"invalid range %q: %w\", rangeStr, err)\n}","typeGuard":null,"tryCatchPattern":"if err := ValidatePulumiVersionRange(rangeStr, cliVer); err != nil {\n\tif strings.Contains(err.Error(), \"parsing CLI version range\") {\n\t\t// fix the range string in the provider build config\n\t}\n\treturn err\n}","preventionTips":["Test provider version-range strings with a semver parser in CI","Use documented Masterminds semver range syntax with full x.y.z versions","Never hand-edit released plugin version metadata"],"tags":["go","semver","version-constraint"],"backgroundTag":"invalid-version-range","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}