{"record":{"id":"316c3d149a091548","repo":"hashicorp/packer","slug":"wrong-version-s-does-not-match-expected-s","errorCode":null,"errorMessage":"wrong version: %s does not match expected %s","messagePattern":"wrong version: (.+?) does not match expected (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packer/plugin-getter/github/getter.go","lineNumber":324,"sourceCode":"\n\tres = strings.TrimSuffix(res, entry.Ext)\n\t// res now looks like v0.2.12_x5.0_freebsd_amd64\n\n\tparts := strings.Split(res, \"_\")\n\t// [\"v0.2.12\", \"x5.0\", \"freebsd\", \"amd64\"]\n\tif len(parts) < 4 {\n\t\treturn fmt.Errorf(\"malformed filename expected %s{version}_x{protocol-version}_{os}_{arch}\", req.FilenamePrefix())\n\t}\n\n\tentry.BinVersion, entry.ProtVersion, entry.Os, entry.Arch = parts[0], parts[1], parts[2], parts[3]\n\n\treturn nil\n}\n\nfunc (g *Getter) Validate(opt plugingetter.GetOptions, expectedVersion string, installOpts plugingetter.BinaryInstallationOptions, entry *plugingetter.ChecksumFileEntry) error {\n\texpectedBinVersion := \"v\" + expectedVersion\n\tif entry.BinVersion != expectedBinVersion {\n\t\treturn fmt.Errorf(\"wrong version: %s does not match expected %s\", entry.BinVersion, expectedBinVersion)\n\t}\n\tif entry.Os != installOpts.OS || entry.Arch != installOpts.ARCH {\n\t\treturn fmt.Errorf(\"wrong system, expected %s_%s\", installOpts.OS, installOpts.ARCH)\n\t}\n\n\treturn installOpts.CheckProtocolVersion(entry.ProtVersion)\n}\n\nfunc (g *Getter) ExpectedFileName(pr *plugingetter.Requirement, version string, entry *plugingetter.ChecksumFileEntry, _ string) string {\n\tpluginSourceParts := strings.Split(pr.Identifier.Source, \"/\")\n\treturn strings.Join([]string{\n\t\t\"packer-plugin-\" + pluginSourceParts[2],\n\t\tentry.BinVersion,\n\t\tentry.ProtVersion,\n\t\tentry.Os,\n\t\tentry.Arch + entry.Ext,\n\t}, \"_\")\n}","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/packer/plugin-getter/github/getter.go#L306-L342","documentation":"Validate() checks that a checksum-file entry's parsed binary version (entry.BinVersion, e.g. \"v1.2.3\") matches the version constraint the user requested, prefixed with \"v\". A mismatch means the entry being validated belongs to a different release than the one being installed.","triggerScenarios":"Getter.Validate() is called with expectedVersion=\"1.2.3\" but entry.BinVersion is e.g. \"v1.2.4\" — i.e. the checksum entry parsed from the releases file has a version string that differs (including missing or extra 'v', or a prerelease suffix) from the requested requirement version.","commonSituations":"required_plugins pins \"= 1.2.3\" but the latest checksum entry picked is 1.2.4; versions listed in the checksum file inconsistently use or omit the \"v\" prefix; a stale/mismatched SHA256SUM file accompanies a newer release.","solutions":["Align the requested version constraint in required_plugins with a version that actually exists in the plugin's releases (run `packer plugins installed` or check GitHub releases).","Ensure release assets and SHA256SUM entries carry versions with a consistent \"v\" prefix matching the git tag.","Regenerate the checksum file so every entry corresponds to the released version."],"exampleFix":"// before (required_plugins)\nmyplug = { version = \"= 1.2.3\", source = \"github.com/foo/myplug\" }\n// after\nmyplug = { version = \"= 1.2.4\", source = \"github.com/foo/myplug\" }","handlingStrategy":"validation","validationCode":"expected := \"v\" + reqVersion\nif entry.BinVersion != expected {\n\treturn fmt.Errorf(\"entry %s != requested %s\", entry.BinVersion, expected)\n}","typeGuard":"func entryMatchesVersion(entry *plugingetter.ChecksumFileEntry, expectedVersion string) bool {\n\treturn entry != nil && entry.BinVersion == \"v\"+expectedVersion\n}","tryCatchPattern":"if err := g.Validate(opt, ver, installOpts, entry); err != nil {\n\tif strings.HasPrefix(err.Error(), \"wrong version\") {\n\t\t// try the next checksum entry matching the constraint\n\t}\n}","preventionTips":["Keep the 'v' prefix consistent between git tags, assets, and checksum files","Pin plugin versions that actually exist in the releases list","Regenerate checksum files on every release"],"tags":["plugin-getter","version-mismatch","plugin-install","github"],"backgroundTag":"version-mismatch","analyzedSha":"eb36e3c3e48a036f3e8cc94087636ee72e1303c9","analyzedAt":"2026-09-05T13:20:43.127Z","contentChangedAt":"2026-09-05T13:20:43.127Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}