{"record":{"id":"b75b04887b128410","repo":"hashicorp/packer","slug":"failed-to-download-and-verify-packer-release-zip","errorCode":null,"errorMessage":"failed to download and verify Packer release zip: %w","messagePattern":"failed to download and verify Packer release zip: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"provisioner/hcp-sbom/packer_release_fetch.go","lineNumber":296,"sourceCode":"\t\tdefer func() { _ = zr.Close() }()\n\n\t\tfoundBinary := false\n\t\tfor _, f := range zr.File {\n\t\t\tif f.Name == binaryName {\n\t\t\t\tfoundBinary = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !foundBinary {\n\t\t\treturn fmt.Errorf(\"packer binary %q not found in release zip %s\", binaryName, zipURL)\n\t\t}\n\n\t\tkeepCandidate = true\n\t\tzipPath = candidateZipPath\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to download and verify Packer release zip: %w\", err)\n\t}\n\n\tlog.Printf(\"[INFO] Downloaded and verified Packer release zip: %s\", zipPath)\n\treturn zipPath, nil\n}\n","sourceCodeStart":278,"sourceCodeEnd":302,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/provisioner/hcp-sbom/packer_release_fetch.go#L278-L302","documentation":"Top-level wrapper in downloadPackerRelease: when the retry.Config.Run loop (3 tries, 5s delay) exhausts, any inner error — version resolution, zip download, checksum fetch/mismatch, zip open, or missing binary — is wrapped with this message. Callers (provisionWithNativeGeneration) receive it after all retries failed.","triggerScenarios":"The retry.Config{ Tries: 3, RetryDelay: 5s }.Run callback returns an error on all 3 attempts; the final error (with %w-wrapped cause) is wrapped again by 'failed to download and verify Packer release zip: %w'.","commonSituations":"Persistent network outage on the build host for the full retry window (~15s+); repeated 404s because the index lists a version whose artifacts aren't published yet; permanent checksum mismatch from a tampering middlebox.","solutions":["Read the innermost wrapped cause (%w chain) — fix that root problem, not the wrapper.","Check outbound access to releases.hashicorp.com and any proxy configuration.","Retry the build after confirming the release artifacts are fully published for the latest version.","Pre-install Packer on the guest or vendor a known-good copy to avoid the auto-download path entirely."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-flight all three endpoints before invoking the provisioner\nfor _, u := range []string{\n\t\"https://releases.hashicorp.com/packer/index.json\",\n} {\n\tresp, err := http.Head(u)\n\tif err != nil || (resp.StatusCode != 200) {\n\t\treturn fmt.Errorf(\"cannot reach %s: aborting before build\", u)\n\t}\n\tresp.Body.Close()\n}","typeGuard":null,"tryCatchPattern":"if err := build(...); err != nil {\n\tif strings.Contains(err.Error(), \"failed to download and verify Packer release zip\") {\n\t\t// all 3 in-band retries exhausted; wait longer, fix network, or pin a pre-installed Packer\n\t\treturn retryBuildAfterNetworkCheck()\n\t}\n\treturn err\n}","preventionTips":["Read the full %w error chain to find the root cause before changing code","Assume 3 retries already happened — don't hammer immediately; fix connectivity first","Pre-install or vendor Packer for hermetic CI environments","Alert on this wrapper error in CI as an infrastructure/network signal, not a code bug"],"tags":["network","retry","download","provisioner"],"backgroundTag":"artifact-download-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"}