{"record":{"id":"26bf69dd204fa35a","repo":"hashicorp/packer","slug":"failed-to-open-s-from-zip-w","errorCode":null,"errorMessage":"failed to open %s from zip: %w","messagePattern":"failed to open (.+?) from zip: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"provisioner/hcp-sbom/provisioner.go","lineNumber":573,"sourceCode":"\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}\n\t\tif closeErr != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to close %s stream from zip: %w\", binaryName, closeErr)\n\t\t}\n\t\treturn data, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"%s not found in zip %s\", binaryName, zipPath)\n}\n\n// runRemoteCmd runs a single shell command on the remote host and returns a\n// descriptive error if it fails.","sourceCodeStart":555,"sourceCodeEnd":591,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/provisioner/hcp-sbom/provisioner.go#L555-L591","documentation":"Runtime error from extractBinaryFromZip: the entry matching the scanner binary name was found in the zip, but opening its decompressed stream failed — typically internal archive corruption in that entry.","triggerScenarios":"Thrown at provisioner/hcp-sbom/provisioner.go:573 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the download to get an intact zip","Inspect the zip entry manually to confirm it's not corrupted"],"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"}