{"record":{"id":"a8baaacf66c85a6d","repo":"hashicorp/packer","slug":"wrong-system-expected-s-s-got-s-s","errorCode":null,"errorMessage":"wrong system, expected %s_%s got %s_%s","messagePattern":"wrong system, expected (.+?)_(.+?) got (.+?)_(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packer/plugin-getter/release/getter.go","lineNumber":164,"sourceCode":"\tparts := strings.Split(res, \"_\")\n\t// [\"0.2.12\", \"freebsd\", \"amd64\"]\n\tif len(parts) < 3 {\n\t\treturn fmt.Errorf(\"malformed filename expected %s{version}_{os}_{arch}\", req.FilenamePrefix())\n\t}\n\n\tentry.BinVersion, entry.Os, entry.Arch = parts[0], parts[1], parts[2]\n\tentry.BinVersion = strings.TrimPrefix(entry.BinVersion, \"v\")\n\n\treturn nil\n}\n\nfunc (g *Getter) Validate(opt plugingetter.GetOptions, expectedVersion string, installOpts plugingetter.BinaryInstallationOptions, entry *plugingetter.ChecksumFileEntry) error {\n\n\tif entry.BinVersion != expectedVersion {\n\t\treturn fmt.Errorf(\"wrong version: %s does not match expected %s\", entry.BinVersion, expectedVersion)\n\t}\n\tif entry.Os != installOpts.OS || entry.Arch != installOpts.ARCH {\n\t\treturn fmt.Errorf(\"wrong system, expected %s_%s got %s_%s\", installOpts.OS, installOpts.ARCH, entry.Os, entry.Arch)\n\t}\n\n\tmanifest, err := g.Get(\"meta\", opt)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar data plugingetter.ManifestMeta\n\tbody, err := io.ReadAll(manifest)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to unmarshal manifest json: %s\", err)\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(body, &data)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to unmarshal manifest json: %s\", err)\n\t\treturn err","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/packer/plugin-getter/release/getter.go#L146-L182","documentation":"Validate also ensures the downloaded binary was built for the host's OS/architecture. If the entry's Os/Arch (parsed from the filename) differ from the BinaryInstallationOptions the installer computed for the current platform, the artifact is unusable and validation fails.","triggerScenarios":"Getter.Validate called with an entry whose Os/Arch don't match installOpts.OS/ARCH — e.g. a darwin_arm64 zip entry evaluated while running on linux_amd64, or entries from a mixed-OS checksum file picked incorrectly.","commonSituations":"Copying plugin binaries between machines of different OS/arch; downloading the wrong asset manually; running Packer under an emulation/ROSETTA setup where the parsed arch differs from the runtime expectation; corrupted or renamed plugin files.","solutions":["Delete the mismatched plugin binary and re-install with `packer plugins install` so the correct os/arch asset is fetched.","Verify the binary filename encodes the platform you are running on (e.g. ..._linux_amd64.zip on linux/amd64).","If cross-installing intentionally, set BinaryInstallationOptions OS/ARCH explicitly to match the target platform."],"exampleFix":"// before (file in plugin dir on linux/amd64)\npacker-plugin-docker_1.1.1_darwin_arm64.zip\n// after\npacker-plugin-docker_1.1.1_linux_amd64.zip","handlingStrategy":"validation","validationCode":"if entry.Os != installOpts.OS || entry.Arch != installOpts.ARCH {\n    return fmt.Errorf(\"asset %s_%s not usable on %s_%s\", entry.Os, entry.Arch, installOpts.OS, installOpts.ARCH)\n}","typeGuard":null,"tryCatchPattern":"if err := g.Validate(opt, ver, installOpts, entry); err != nil {\n    if strings.Contains(err.Error(), \"wrong system\") {\n        // delete the foreign-arch binary and reinstall\n    }\n}","preventionTips":["Don't copy plugin binaries between machines with different OS/arch.","After changing hardware or CI runners, reinstall plugins rather than reusing cached dirs.","Verify runtime.GOOS/GOARCH expectations match downloaded assets."],"tags":["packer","plugin-getter","platform-mismatch","os-arch"],"backgroundTag":"platform-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"}