{"record":{"id":"73f4a7bb3c324db4","repo":"pulumi/pulumi","slug":"invalid-version-s","errorCode":null,"errorMessage":"invalid version %s","messagePattern":"invalid version (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/go/common/workspace/plugins.go","lineNumber":408,"sourceCode":"\treturn gitutil.GetLatestTagOrHash(ctx, source.url)\n}\n\n// Downloads a plugin from a git repository.  If the version is a pre-release version, the version is expected to be\n// a commit hash, that will be checked out.  Otherwise, the version is expected to be a tag, that will be checked out.\n// The tag is expected to be prefixed with a 'v' character.\n// If the version is the special sentinel version 0.0.0, we'll use the latest commit on the default branch.\nfunc (source *gitSource) Download(\n\tctx context.Context, version semver.Version, _ string, _ string,\n\t_ func(*http.Request) (io.ReadCloser, int64, error),\n) (io.ReadCloser, int64, error) {\n\ttmpdir, err := os.MkdirTemp(\"\", \"pulumi-plugin\")\n\tif err != nil {\n\t\treturn nil, -1, err\n\t}\n\tdefer os.RemoveAll(tmpdir)\n\tif isPreReleaseVersion(version) {\n\t\tif len(version.Pre) != 1 {\n\t\t\treturn nil, -1, fmt.Errorf(\"invalid version %s\", version)\n\t\t}\n\t\t// The version string is prefixed with a 'x' character because Pre-versions can't\n\t\t// start with a 0. Strip that off to get the actual hash.  Note that we allow short\n\t\t// hashes, so we need to create a go-git revision that's then resolved to a full hash.\n\t\trevision := plumbing.Revision(version.Pre[0].VersionStr[1:])\n\t\terr := source.cloneAndCheckoutRevision(ctx, source.url, revision, tmpdir)\n\t\tif err != nil {\n\t\t\treturn nil, -1, err\n\t\t}\n\t} else {\n\t\tvar ref plumbing.ReferenceName\n\t\tif version.Major == 0 && version.Minor == 0 && version.Patch == 0 {\n\t\t\tref = plumbing.HEAD\n\t\t} else {\n\t\t\tref = plumbing.ReferenceName(\"refs/tags/v\" + version.String())\n\t\t}\n\t\terr := source.cloneOrPull(ctx, source.url, ref, tmpdir, true /* shallow */)\n\t\tif err != nil {","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/go/common/workspace/plugins.go#L390-L426","documentation":"When a plugin version is a pre-release, this code expects exactly one pre-release component which encodes a git revision: the actual hash prefixed with an 'x' character (because semver pre-release strings cannot start with 0). This error is thrown when a pre-release version has zero or more-than-one pre-release segments, so no revision hash can be extracted.","triggerScenarios":"Calling install/download with a version like 1.0.0-alpha.beta (two pre segments) or constructing a pre-release version manually that doesn't follow the x<hash> convention the source expects.","commonSituations":"Hand-crafting pre-release plugin versions instead of using the SDK's x-prefixed hash scheme; versions copied from other tooling with multi-part pre-release identifiers.","solutions":["Use a pre-release version of the form <semver>-x<commit-sha>, e.g. 1.0.0-xabc1234def","If you meant a stable release, drop the pre-release suffix entirely","Generate the version via the SDK/tooling rather than hand-writing it"],"exampleFix":"// before\nversion := \"1.0.0-alpha.beta\"\n// after\nversion := \"1.0.0-xabc1234\" // 'x' + git revision","handlingStrategy":"validation","validationCode":"v, err := semver.Parse(versionStr)\nif err != nil { return err }\nif v.Pre != nil && len(v.Pre) != 1 {\n    return fmt.Errorf(\"pre-release versions must have exactly one segment: <semver>-x<sha>\")\n}","typeGuard":"func isHashPrerelease(v semver.Version) bool {\n    return len(v.Pre) == 1 && len(v.Pre[0].VersionStr) > 1 && v.Pre[0].VersionStr[0] == 'x'\n}","tryCatchPattern":null,"preventionTips":["Always build pre-release plugin versions as <semver>-x<commit-sha>","Never hand-edit pre-release version strings; use SDK tooling","Prefer stable releases unless testing a specific commit build"],"tags":["go","plugins","semver","versioning"],"backgroundTag":"invalid-prerelease-version","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}