hashicorp/packer · error

wrong system, expected %s_%s got %s_%s

Error message

wrong system, expected %s_%s got %s_%s

What it means

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.

Source

Thrown at packer/plugin-getter/release/getter.go:164

	parts := strings.Split(res, "_")
	// ["0.2.12", "freebsd", "amd64"]
	if len(parts) < 3 {
		return fmt.Errorf("malformed filename expected %s{version}_{os}_{arch}", req.FilenamePrefix())
	}

	entry.BinVersion, entry.Os, entry.Arch = parts[0], parts[1], parts[2]
	entry.BinVersion = strings.TrimPrefix(entry.BinVersion, "v")

	return nil
}

func (g *Getter) Validate(opt plugingetter.GetOptions, expectedVersion string, installOpts plugingetter.BinaryInstallationOptions, entry *plugingetter.ChecksumFileEntry) error {

	if entry.BinVersion != expectedVersion {
		return fmt.Errorf("wrong version: %s does not match expected %s", entry.BinVersion, expectedVersion)
	}
	if entry.Os != installOpts.OS || entry.Arch != installOpts.ARCH {
		return fmt.Errorf("wrong system, expected %s_%s got %s_%s", installOpts.OS, installOpts.ARCH, entry.Os, entry.Arch)
	}

	manifest, err := g.Get("meta", opt)
	if err != nil {
		return err
	}

	var data plugingetter.ManifestMeta
	body, err := io.ReadAll(manifest)
	if err != nil {
		log.Printf("Failed to unmarshal manifest json: %s", err)
		return err
	}

	err = json.Unmarshal(body, &data)
	if err != nil {
		log.Printf("Failed to unmarshal manifest json: %s", err)
		return err

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Delete the mismatched plugin binary and re-install with `packer plugins install` so the correct os/arch asset is fetched.
  2. Verify the binary filename encodes the platform you are running on (e.g. ..._linux_amd64.zip on linux/amd64).
  3. If cross-installing intentionally, set BinaryInstallationOptions OS/ARCH explicitly to match the target platform.

Example fix

// before (file in plugin dir on linux/amd64)
packer-plugin-docker_1.1.1_darwin_arm64.zip
// after
packer-plugin-docker_1.1.1_linux_amd64.zip
Defensive patterns

Strategy: validation

Validate before calling

if entry.Os != installOpts.OS || entry.Arch != installOpts.ARCH {
    return fmt.Errorf("asset %s_%s not usable on %s_%s", entry.Os, entry.Arch, installOpts.OS, installOpts.ARCH)
}

Try / catch

if err := g.Validate(opt, ver, installOpts, entry); err != nil {
    if strings.Contains(err.Error(), "wrong system") {
        // delete the foreign-arch binary and reinstall
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05). Data as JSON: /api/errors/a8baaacf66c85a6d. Report an issue: GitHub.