{"record":{"id":"44518195ceff4fe9","repo":"hashicorp/packer","slug":"failed-to-read-s-from-zip-w","errorCode":null,"errorMessage":"failed to read %s from zip: %w","messagePattern":"failed to read (.+?) from zip: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"provisioner/hcp-sbom/provisioner.go","lineNumber":579,"sourceCode":"\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.\nfunc (p *Provisioner) runRemoteCmd(ctx context.Context, comm packersdk.Communicator, cmdStr, step string) error {\n\tvar stderr bytes.Buffer\n\tcmd := &packersdk.RemoteCmd{\n\t\tCommand: cmdStr,\n\t\tStderr:  &stderr,\n\t}","sourceCodeStart":561,"sourceCodeEnd":597,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/provisioner/hcp-sbom/provisioner.go#L561-L597","documentation":"extractBinaryFromZip scans the SBOM scanner tool's zip archive for the scanner binary and streams it out. This error wraps an io.Read failure on the matched zip entry — the archive entry exists and opened, but its decompressed bytes could not be read (truncated/corrupt archive, I/O error). The wrapped cause identifies the underlying problem; re-download or replace the scanner zip.","triggerScenarios":"Thrown at provisioner/hcp-sbom/provisioner.go:579 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the build to obtain a fresh download","Check for failing disks or flaky network if it recurs"],"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"}