hashicorp/packer · error
malformed filename %s: expected %s{version}_x{protocol-versi
Error message
malformed filename %s: expected %s{version}_x{protocol-version}_{os}_{arch} or %s{version}_{os}_{arch} What it means
Remote getter error from Init: the checksum-file entry's filename doesn't match either accepted shape — {prefix}{version}_x{protocol}_{os}_{arch} (GitHub style) or {prefix}{version}_{os}_{arch} (releases.hashicorp.com style) — so its metadata cannot be parsed.
Source
Thrown at packer/plugin-getter/remote/getter.go:290
func (g *Getter) Init(req *plugingetter.Requirement, entry *plugingetter.ChecksumFileEntry) error {
filename := entry.Filename
res := strings.TrimPrefix(filename, req.FilenamePrefix())
entry.Ext = filepath.Ext(res)
res = strings.TrimSuffix(res, entry.Ext)
parts := strings.Split(res, "_")
switch {
case len(parts) >= 4 && protocolVersionRe.MatchString(parts[1]):
if !strings.HasPrefix(parts[0], "v") {
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.jsonView on GitHub (pinned to eb36e3c3e4)
Solutions
- Rename the release asset to follow the standard packer-plugin naming convention
- Verify the checksum file references assets with the exact expected names
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packer/plugin-getter/remote/getter.go:290 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05).
Data as JSON: /api/errors/5b90a8823b9a0be1.
Report an issue: GitHub.