{"record":{"id":"81b44975a43cf90a","repo":"hashicorp/packer","slug":"failed-to-open-temp-file-w","errorCode":null,"errorMessage":"failed to open temp file: %w","messagePattern":"failed to open temp file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packer/plugin-getter/plugins.go","lineNumber":861,"sourceCode":"\t\t\t\t\tif err := checksum.Checksummer.Checksum(checksum.Expected, tmpFile); err != nil {\n\t\t\t\t\t\terr := fmt.Errorf(\"%w. Is the checksum file correct ? Is the binary file correct ?\", err)\n\t\t\t\t\t\terrs = multierror.Append(errs, err)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tzr, err := zip.OpenReader(tmpFile.Name())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\terrs = multierror.Append(errs, fmt.Errorf(\"zip : %v\", err))\n\t\t\t\t\t\treturn nil, errs\n\t\t\t\t\t}\n\n\t\t\t\t\tvar copyFrom io.ReadCloser\n\t\t\t\t\tfor _, f := range zr.File {\n\t\t\t\t\t\tif f.Name != expectedBinaryFilename {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcopyFrom, err = f.Open()\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\terrs = multierror.Append(errs, fmt.Errorf(\"failed to open temp file: %w\", err))\n\t\t\t\t\t\t\treturn nil, errs\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tif copyFrom == nil {\n\t\t\t\t\t\terr := fmt.Errorf(\"could not find a %q file in zipfile\", expectedBinaryFilename)\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\n\t\t\t\t\tvar outputFileData bytes.Buffer\n\t\t\t\t\tif _, err := io.Copy(&outputFileData, copyFrom); err != nil {\n\t\t\t\t\t\terr := fmt.Errorf(\"extract 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\ttmpBinFileName := filepath.Join(os.TempDir(), expectedBinaryFilename)\n\t\t\t\t\ttmpOutputFile, err := os.OpenFile(tmpBinFileName, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)","sourceCodeStart":843,"sourceCodeEnd":879,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/packer/plugin-getter/plugins.go#L843-L879","documentation":"Despite the message, this error is not about creating the temp file: it fires when opening an entry inside the already-downloaded plugin zip archive fails. In InstallLatest, after the plugin zip is written to a temp file and opened with zip.OpenReader, the entry matching the expected plugin binary filename is located and f.Open() is called to get a reader for that entry; if that per-entry open fails (corrupt or truncated download, unsupported compression method, CRC/layout problems within the archive), the wrapped error is appended to the multierror list and installation of the plugin is aborted.","triggerScenarios":"Thrown at packer/plugin-getter/plugins.go:861 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the full download/verification log above this error: a checksum mismatch that was skipped or a truncated network transfer usually precedes a corrupt zip entry","Delete the cached plugin download and retry `packer init` so the plugin zip is fetched again","Verify the plugin's released zip artifact on the origin server is valid (open it manually with `unzip -t`), and report it to the plugin maintainer if it is broken","If running behind a proxy or cached mirror, bypass it and re-download, since proxies sometimes corrupt binary zip content"],"exampleFix":null,"handlingStrategy":"fallback","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"}