{"record":{"id":"c9ac7cd892e5a9a0","repo":"hashicorp/packer","slug":"malformed-filename-s-version-q-must-have-a-v-pr","errorCode":null,"errorMessage":"malformed filename %s: version %q must have a v prefix alongside a protocol version","messagePattern":"malformed filename (.+?): version %q must have a v prefix alongside a protocol version","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packer/plugin-getter/remote/getter.go","lineNumber":283,"sourceCode":"// Init parses a checksum-file entry name in either accepted shape:\n//\n//\tpacker-plugin-comment_v0.2.12_x5.0_freebsd_amd64.zip  (GitHub release asset)\n//\tpacker-plugin-docker_1.1.4_darwin_arm64.zip           (releases.hashicorp.com)\n//\n// The releases.hashicorp.com shape carries no protocol version; Validate\n// fills it from the version's manifest.json.\nfunc (g *Getter) Init(req *plugingetter.Requirement, entry *plugingetter.ChecksumFileEntry) error {\n\tfilename := entry.Filename\n\tres := strings.TrimPrefix(filename, req.FilenamePrefix())\n\n\tentry.Ext = filepath.Ext(res)\n\tres = strings.TrimSuffix(res, entry.Ext)\n\n\tparts := strings.Split(res, \"_\")\n\tswitch {\n\tcase len(parts) >= 4 && protocolVersionRe.MatchString(parts[1]):\n\t\tif !strings.HasPrefix(parts[0], \"v\") {\n\t\t\treturn fmt.Errorf(\"malformed filename %s: version %q must have a v prefix alongside a protocol version\", filename, parts[0])\n\t\t}\n\t\tentry.BinVersion, entry.ProtVersion, entry.Os, entry.Arch = parts[0], parts[1], parts[2], parts[3]\n\tcase len(parts) == 3 && !strings.HasPrefix(parts[0], \"v\"):\n\t\tentry.BinVersion, entry.Os, entry.Arch = \"v\"+parts[0], parts[1], parts[2]\n\t\tentry.ProtVersion = \"\"\n\tdefault:\n\t\treturn fmt.Errorf(\n\t\t\t\"malformed filename %s: expected %s{version}_x{protocol-version}_{os}_{arch} or %s{version}_{os}_{arch}\",\n\t\t\tfilename, req.FilenamePrefix(), req.FilenamePrefix())\n\t}\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)","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/packer/plugin-getter/remote/getter.go#L265-L301","documentation":"Remote getter error from Init: a checksum-file entry uses the GitHub-style name with a protocol version (e.g. ..._v0.2.12_x5.0_...), but the version token lacks the required 'v' prefix, so the filename cannot be parsed into version/protocol parts.","triggerScenarios":"Thrown at packer/plugin-getter/remote/getter.go:283 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the checksum entry's filename to include the v prefix on the version (v1.2.3 not 1.2.3) when a protocol version is embedded","Regenerate/republish the checksum file with correctly named assets"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}