{"record":{"id":"b5817842fae332f5","repo":"hashicorp/packer","slug":"unrecognized-checksum-type-s","errorCode":null,"errorMessage":"Unrecognized checksum type: %s","messagePattern":"Unrecognized checksum type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"post-processor/checksum/post-processor.go","lineNumber":81,"sourceCode":"\t\tInterpolate:        true,\n\t\tInterpolateContext: &p.config.ctx,\n\t\tInterpolateFilter: &interpolate.RenderFilter{\n\t\t\tExclude: []string{\"output\"},\n\t\t},\n\t}, raws...)\n\tif err != nil {\n\t\treturn err\n\t}\n\terrs := new(packersdk.MultiError)\n\n\tif p.config.ChecksumTypes == nil {\n\t\tp.config.ChecksumTypes = []string{\"md5\"}\n\t}\n\n\tfor _, k := range p.config.ChecksumTypes {\n\t\tif h := getHash(k); h == nil {\n\t\t\terrs = packersdk.MultiErrorAppend(errs,\n\t\t\t\tfmt.Errorf(\"Unrecognized checksum type: %s\", k))\n\t\t}\n\t}\n\n\tif p.config.OutputPath == \"\" {\n\t\tp.config.OutputPath = \"packer_{{.BuildName}}_{{.BuilderType}}_{{.ChecksumType}}.checksum\"\n\t}\n\n\tif err = interpolate.Validate(p.config.OutputPath, &p.config.ctx); err != nil {\n\t\terrs = packersdk.MultiErrorAppend(\n\t\t\terrs, fmt.Errorf(\"Error parsing target template: %s\", err))\n\t}\n\n\tif len(errs.Errors) > 0 {\n\t\treturn errs\n\t}\n\n\treturn nil\n}","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/post-processor/checksum/post-processor.go#L63-L99","documentation":"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.","triggerScenarios":"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.","commonSituations":"Typo in the algorithm name; assuming other algorithms (crc32, sha3, blake2) are supported; uppercase names copied from docs or tooling.","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"],"exampleFix":"// before\nchecksum_types = [\"SHA256\"]\n// after\nchecksum_types = [\"sha256\"]","handlingStrategy":"validation","validationCode":"// Go: whitelist checksum types before passing them to the template\ndf, err := templatefile... // or in shell:\n// case \"$ct\" in md5|sha1|sha224|sha256|sha384|sha512) ;; *) echo \"bad type $ct\"; exit 1;; esac","typeGuard":"func validChecksumType(s string) bool {\n  switch s {\n  case \"md5\", \"sha1\", \"sha224\", \"sha256\", \"sha384\", \"sha512\":\n    return true\n  }\n  return false\n}","tryCatchPattern":"if err := pp.Configure(raws); err != nil {\n    var me *packersdk.MultiError\n    if errors.As(err, &me) {\n        for _, e := range me.Errors {\n            if strings.Contains(e.Error(), \"Unrecognized checksum type\") {\n                // correct checksum_types to a supported value\n            }\n        }\n    }\n    return err\n}","preventionTips":["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"],"tags":["packer","post-processor","checksum","config-validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"eb36e3c3e48a036f3e8cc94087636ee72e1303c9","analyzedAt":"2026-09-05T13:20:43.127Z","contentChangedAt":"2026-09-05T13:20:43.127Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}