{"record":{"id":"801e687378dfcafc","repo":"hashicorp/packer","slug":"failed-to-checksum-binary-file-s","errorCode":null,"errorMessage":"failed to checksum binary file: %s","messagePattern":"failed to checksum binary file: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packer/plugin-getter/plugins.go","lineNumber":927,"sourceCode":"\t\t\t\t\t\tlog.Printf(\"[TRACE] %s\", err.Error())\n\t\t\t\t\t\treturn nil, errs\n\t\t\t\t\t}\n\t\t\t\t\toutputFile, err := os.OpenFile(outputFileName, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\terr = fmt.Errorf(\"could not create final plugin binary file: %w\", err)\n\t\t\t\t\t\terrs = multierror.Append(errs, err)\n\t\t\t\t\t\treturn nil, errs\n\t\t\t\t\t}\n\t\t\t\t\tif _, err := outputFile.Write(outputFileData.Bytes()); err != nil {\n\t\t\t\t\t\terr = fmt.Errorf(\"could not write final plugin binary file: %w\", err)\n\t\t\t\t\t\terrs = multierror.Append(errs, err)\n\t\t\t\t\t\treturn nil, errs\n\t\t\t\t\t}\n\t\t\t\t\toutputFile.Close()\n\n\t\t\t\t\tcs, err = checksum.Checksummer.Sum(&outputFileData)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\terr := fmt.Errorf(\"failed to checksum binary file: %s\", err)\n\t\t\t\t\t\terrs = multierror.Append(errs, err)\n\t\t\t\t\t\tlog.Printf(\"[WARNING] %v, ignoring\", err)\n\t\t\t\t\t}\n\t\t\t\t\tif err := os.WriteFile(outputFileName+checksum.Checksummer.FileExt(), []byte(hex.EncodeToString(cs)), 0644); err != nil {\n\t\t\t\t\t\terr := fmt.Errorf(\"failed to write local binary checksum file: %s\", err)\n\t\t\t\t\t\terrs = multierror.Append(errs, err)\n\t\t\t\t\t\tlog.Printf(\"[WARNING] %v, ignoring\", err)\n\t\t\t\t\t\tos.Remove(outputFileName)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\t// Success !!\n\t\t\t\t\treturn &Installation{\n\t\t\t\t\t\tBinaryPath: strings.ReplaceAll(outputFileName, \"\\\\\", \"/\"),\n\t\t\t\t\t\tVersion:    \"v\" + version.String(),\n\t\t\t\t\t}, nil\n\t\t\t\t}\n","sourceCodeStart":909,"sourceCodeEnd":945,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/packer/plugin-getter/plugins.go#L909-L945","documentation":"After writing the plugin binary, InstallLatest computes a checksum over the buffered data. If checksum.Checksummer.Sum fails, the error is appended but explicitly logged as a warning and installation continues. This means the .SHA256SUM-sidecar may be missing/stale for the installed binary.","triggerScenarios":"checksum.Checksummer.Sum(&outputFileData) returns a non-nil error inside InstallLatest (hasher misconfiguration or hashing failure on the buffer).","commonSituations":"Rare in practice — usually indicates an internal inconsistency in the checksummer setup rather than user error; users see it as a WARNING line during `packer init` followed by continued install.","solutions":["Read the wrapped cause (%s) in the WARNING log line to identify the hashing failure","Re-run `packer init` — if transient, the checksum file will be written correctly on a clean retry","Delete the affected plugin binary from the plugins directory and reinstall from scratch","If persistent, report the packer version and error, since this path is normally unreachable"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// treat as non-fatal but verify afterwards\nout, err := run(\"packer\", \"init\", \".\")\nif strings.Contains(out, \"failed to checksum binary file\") {\n    log.Println(\"checksum sidecar missing; re-running init\")\n    run(\"packer\", \"init\", \".\") // retry once\n}","preventionTips":["Re-run packer init when this WARNING appears; it is usually transient","Watch CI logs for this warning and fail the job if checksum files are required downstream","Keep packer updated — this path is normally unreachable"],"tags":["plugin-install","checksum","packer"],"backgroundTag":"checksum-verification-failed","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"}