{"record":{"id":"056c422b48ebf1a6","repo":"hashicorp/nomad","slug":"invalid-checksum-v","errorCode":null,"errorMessage":"invalid checksum: %v","messagePattern":"invalid checksum: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":9981,"sourceCode":"\t}\n\n\t// Cut on the first colon only: a \"file:<url>\" checksum carries a URL\n\t// value that may itself contain colons (e.g. a port).\n\tchecksumType, checksumVal, ok := strings.Cut(check, \":\")\n\tif !ok {\n\t\treturn fmt.Errorf(`checksum must be given as \"type:value\"; got %q`, check)\n\t}\n\n\t// A \"file:<url>\" checksum tells go-getter to read the checksum from a\n\t// remote file rather than supplying a hex digest inline, so there is no\n\t// digest to validate here; the getter resolves it at fetch time.\n\tif checksumType == \"file\" {\n\t\treturn nil\n\t}\n\n\tchecksumBytes, err := hex.DecodeString(checksumVal)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid checksum: %v\", err)\n\t}\n\n\texpectedLength := 0\n\tswitch checksumType {\n\tcase \"md5\":\n\t\tif fips140.Enabled() {\n\t\t\treturn fmt.Errorf(\"md5 checksums are not supported in FIPS-140 mode\")\n\t\t}\n\t\texpectedLength = md5.Size\n\tcase \"sha1\":\n\t\tif fips140.Enabled() {\n\t\t\treturn fmt.Errorf(\"sha1 checksums are not supported in FIPS-140 mode\")\n\t\t}\n\t\texpectedLength = sha1.Size\n\tcase \"sha256\":\n\t\texpectedLength = sha256.Size\n\tcase \"sha512\":\n\t\texpectedLength = sha512.Size","sourceCodeStart":9963,"sourceCodeEnd":9999,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L9963-L9999","documentation":"The value part of the \"type:value\" checksum must be a valid hex-encoded digest. hex.DecodeString fails on non-hex characters or an odd-length string, and the underlying decode error is wrapped as 'invalid checksum: %v'.","triggerScenarios":"checksum = \"sha256:xyz\" (non-hex characters), an odd number of hex digits, stray whitespace/quotes inside the value, or a base64 digest pasted where hex is expected.","commonSituations":"Copying a base64 digest from CI output instead of hex; truncated or concatenated digests; hidden whitespace from copy-paste.","solutions":["Regenerate the digest in lowercase hex, e.g. sha256sum file.","Ensure the value length is even and contains only [0-9a-fA-F].","Trim whitespace/quotes; if you have base64, convert it to hex first."],"exampleFix":"// before\nchecksum = \"sha256:YWJjZGVm\"  # base64\n// after\nchecksum = \"sha256:e80b5017098950fc58aad83c8c14978e...\"  # hex","handlingStrategy":"validation","validationCode":"if _, err := hex.DecodeString(checksumVal); err != nil {\n    return fmt.Errorf(\"checksum value must be hex: %v\", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate digests with sha256sum (hex output), not base64 tools","Check for even-length, [0-9a-f] only strings","Strip whitespace before validating"],"tags":["nomad","checksum","hex","validation"],"backgroundTag":"checksum-validation-failed","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}