hashicorp/packer · error

wrong version: %s does not match expected %s

Error message

wrong version: %s does not match expected %s

What it means

Remote getter error from Validate: the version parsed from the checksum entry's filename doesn't equal the version selected for installation (missing the expected v-prefixed semver), indicating the checksum file lists a different build than the one downloaded.

Source

Thrown at packer/plugin-getter/remote/getter.go:301

			return fmt.Errorf("malformed filename %s: version %q must have a v prefix alongside a protocol version", filename, parts[0])
		}
		entry.BinVersion, entry.ProtVersion, entry.Os, entry.Arch = parts[0], parts[1], parts[2], parts[3]
	case len(parts) == 3 && !strings.HasPrefix(parts[0], "v"):
		entry.BinVersion, entry.Os, entry.Arch = "v"+parts[0], parts[1], parts[2]
		entry.ProtVersion = ""
	default:
		return fmt.Errorf(
			"malformed filename %s: expected %s{version}_x{protocol-version}_{os}_{arch} or %s{version}_{os}_{arch}",
			filename, req.FilenamePrefix(), req.FilenamePrefix())
	}

	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)
	}

	if entry.ProtVersion == "" {
		// The protocol version was resolved from the version's manifest.json
		// when its checksum file was fetched.
		pv, ok := g.protVersions[opt.VersionString()]
		if !ok {
			return fmt.Errorf("no protocol version known for version %s", expectedVersion)
		}
		entry.ProtVersion = pv
	}

	return installOpts.CheckProtocolVersion(entry.ProtVersion)
}

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Ensure the checksum file corresponds to the exact release version being installed
  2. Re-sync the mirror so index.json, checksums, and assets are from the same release
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packer/plugin-getter/remote/getter.go:301 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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