{"record":{"id":"8f7f5dc9e7adb2e1","repo":"hashicorp/packer","slug":"failed-to-open-zip-w","errorCode":null,"errorMessage":"failed to open zip: %w","messagePattern":"failed to open zip: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"provisioner/hcp-sbom/provisioner.go","lineNumber":562,"sourceCode":"\t\tif err := p.runRemoteCmd(ctx, comm, chmodCmd, \"chmod scanner binary\"); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\t// Final verify: confirm binary is executable.\n\t\tverifyCmd := fmt.Sprintf(`test -x \"%s\"`, remotePath)\n\t\tif err := p.runRemoteCmd(ctx, comm, verifyCmd, \"verify scanner is executable\"); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"scanner binary is not executable at %s after chmod; \"+\n\t\t\t\t\"check that /tmp is not mounted noexec on the remote host\", remotePath)\n\t\t}\n\t}\n\n\treturn remotePath, nil\n}\n\nfunc extractBinaryFromZip(zipPath, binaryName string) ([]byte, error) {\n\tzr, err := zip.OpenReader(zipPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open zip: %w\", err)\n\t}\n\tdefer func() { _ = zr.Close() }()\n\n\tfor _, f := range zr.File {\n\t\tif f.Name != binaryName {\n\t\t\tcontinue\n\t\t}\n\n\t\trc, err := f.Open()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to open %s from zip: %w\", binaryName, err)\n\t\t}\n\n\t\tdata, readErr := io.ReadAll(rc)\n\t\tcloseErr := rc.Close()\n\t\tif readErr != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read %s from zip: %w\", binaryName, readErr)\n\t\t}","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/provisioner/hcp-sbom/provisioner.go#L544-L580","documentation":"Runtime error from extractBinaryFromZip in the hcp-sbom provisioner: the downloaded Packer release zip could not be opened as an archive (zip.OpenReader failed) — a corrupted or truncated download, or an unreadable file path.","triggerScenarios":"Thrown at provisioner/hcp-sbom/provisioner.go:562 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the build to re-download the release zip","Check disk space and network reliability; verify the zip opens with `unzip -t`"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}