hashicorp/packer · error
Unrecognized checksum type: %s
Error message
Unrecognized checksum type: %s
What it means
Configuration-time validation for the checksum post-processor: each entry in `checksum_types` must be one of the supported hash algorithms (md5, sha1, sha224, sha256, sha384, sha512). getHash(k) returning nil (no matching hash constructor) triggers this per-type error, accumulated into a MultiError.
Source
Thrown at post-processor/checksum/post-processor.go:81
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{
Exclude: []string{"output"},
},
}, raws...)
if err != nil {
return err
}
errs := new(packersdk.MultiError)
if p.config.ChecksumTypes == nil {
p.config.ChecksumTypes = []string{"md5"}
}
for _, k := range p.config.ChecksumTypes {
if h := getHash(k); h == nil {
errs = packersdk.MultiErrorAppend(errs,
fmt.Errorf("Unrecognized checksum type: %s", k))
}
}
if p.config.OutputPath == "" {
p.config.OutputPath = "packer_{{.BuildName}}_{{.BuilderType}}_{{.ChecksumType}}.checksum"
}
if err = interpolate.Validate(p.config.OutputPath, &p.config.ctx); err != nil {
errs = packersdk.MultiErrorAppend(
errs, fmt.Errorf("Error parsing target template: %s", err))
}
if len(errs.Errors) > 0 {
return errs
}
return nil
}View on GitHub (pinned to eb36e3c3e4)
Solutions
- Use one of the supported types: md5, sha1, sha224, sha256, sha384, sha512
- Lowercase the value — the lookup is case-sensitive
- Run packer validate on the template to catch the bad type before a long build
Example fix
// before checksum_types = ["SHA256"] // after checksum_types = ["sha256"]
Defensive patterns
Strategy: validation
Validate before calling
// Go: whitelist checksum types before passing them to the template df, err := templatefile... // or in shell: // case "$ct" in md5|sha1|sha224|sha256|sha384|sha512) ;; *) echo "bad type $ct"; exit 1;; esac
Type guard
func validChecksumType(s string) bool {
switch s {
case "md5", "sha1", "sha224", "sha256", "sha384", "sha512":
return true
}
return false
} Try / catch
if err := pp.Configure(raws); err != nil {
var me *packersdk.MultiError
if errors.As(err, &me) {
for _, e := range me.Errors {
if strings.Contains(e.Error(), "Unrecognized checksum type") {
// correct checksum_types to a supported value
}
}
}
return err
} Prevention
- Use only md5, sha1, sha224, sha256, sha384, sha512 (lowercase)
- Never uppercase the type names — lookup is case-sensitive
- Run packer validate before long builds
- Prefer sha256 unless a consumer requires a legacy type
When it happens
Trigger: Setting checksum_types to an unsupported string, e.g. ["sha3"], ["SHA256"] (case mismatch, since lookup is exact lowercase), or a typo like ["sha25"], in either HCL2 or JSON templates.
Common situations: Typo in the algorithm name; assuming other algorithms (crc32, sha3, blake2) are supported; uppercase names copied from docs or tooling.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- No files specified in artifice configuration
- Error parsing target template: %s
- unable to create dir: %s
- unable to create file %s: %s
- unable to open file %s: %s
AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05).
Data as JSON: /api/errors/b5817842fae332f5.
Report an issue: GitHub.