hashicorp/packer · error

wrong system, expected %s_%s

Error message

wrong system, expected %s_%s

What it means

Validate() also verifies the entry's OS and architecture match the machine Packer is running on (installOpts.OS/ARCH). If the checksum entry was parsed for a different os_arch combination, it is rejected because the binary would not run on this host.

Source

Thrown at packer/plugin-getter/github/getter.go:327

	parts := strings.Split(res, "_")
	// ["v0.2.12", "x5.0", "freebsd", "amd64"]
	if len(parts) < 4 {
		return fmt.Errorf("malformed filename expected %s{version}_x{protocol-version}_{os}_{arch}", req.FilenamePrefix())
	}

	entry.BinVersion, entry.ProtVersion, entry.Os, entry.Arch = parts[0], parts[1], parts[2], parts[3]

	return nil
}

func (g *Getter) Validate(opt plugingetter.GetOptions, expectedVersion string, installOpts plugingetter.BinaryInstallationOptions, entry *plugingetter.ChecksumFileEntry) error {
	expectedBinVersion := "v" + expectedVersion
	if entry.BinVersion != expectedBinVersion {
		return fmt.Errorf("wrong version: %s does not match expected %s", entry.BinVersion, expectedBinVersion)
	}
	if entry.Os != installOpts.OS || entry.Arch != installOpts.ARCH {
		return fmt.Errorf("wrong system, expected %s_%s", installOpts.OS, installOpts.ARCH)
	}

	return installOpts.CheckProtocolVersion(entry.ProtVersion)
}

func (g *Getter) ExpectedFileName(pr *plugingetter.Requirement, version string, entry *plugingetter.ChecksumFileEntry, _ string) string {
	pluginSourceParts := strings.Split(pr.Identifier.Source, "/")
	return strings.Join([]string{
		"packer-plugin-" + pluginSourceParts[2],
		entry.BinVersion,
		entry.ProtVersion,
		entry.Os,
		entry.Arch + entry.Ext,
	}, "_")
}

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Check that the plugin release publishes an asset for your OS/arch; if not, build the plugin yourself for that platform and install it into PACKER_PLUGIN_PATH.
  2. Verify the asset filenames follow the _{os}_{arch} convention so parsing assigns the right fields.
  3. Run Packer on a platform the plugin supports, or ask the plugin maintainer to add the missing platform.

Example fix

// release lacks darwin_arm64 — build it yourself
GOOS=darwin GOARCH=arm64 go build -o packer-plugin-foo_1.0.0_x5.0_darwin_arm64 .
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)
}

Type guard

func entryMatchesPlatform(entry *plugingetter.ChecksumFileEntry, opts plugingetter.BinaryInstallationOptions) bool {
	return entry != nil && entry.Os == opts.OS && entry.Arch == opts.ARCH
}

Try / catch

if err := g.Validate(opt, ver, installOpts, entry); err != nil {
	if strings.HasPrefix(err.Error(), "wrong system") {
		return fmt.Errorf("plugin has no %s_%s build; skipping", installOpts.OS, installOpts.ARCH)
	}
}

Prevention

When it happens

Trigger: Getter.Validate() is given an entry where entry.Os != installOpts.OS or entry.Arch != installOpts.ARCH — e.g. iterating checksum entries and encountering a linux_amd64 asset while installing on darwin_arm64.

Common situations: Installing a plugin whose release lacks an asset for your OS/arch so only foreign-platform entries exist; a misparsed filename maps the wrong OS/arch fields (see the malformed-filename error); running Packer on an unusual platform (e.g. freebsd/arm64) not published upstream.

Related errors


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