projectdiscovery/nuclei · error

could not close: %+v

Error message

could not close: %+v

What it means

Error "could not close: %+v" thrown in projectdiscovery/nuclei.

Source

Thrown at pkg/protocols/file/request.go:160

					request.options.Progress.AddToTotal(1)
					reader, err := archiveInstance.OpenReader(stream)
					if err != nil {
						gologger.Error().Msgf("%s\n", err)
						// error while elaborating the file
						request.options.Progress.IncrementFailedRequestsBy(1)
						return
					}
					fileStat, _ := fi.Stat()
					tmpFileOut, err := os.CreateTemp("", "")
					if err != nil {
						gologger.Error().Msgf("%s\n", err)
						// error while elaborating the file
						request.options.Progress.IncrementFailedRequestsBy(1)
						return
					}
					defer func() {
						if err := tmpFileOut.Close(); err != nil {
							panic(fmt.Errorf("could not close: %+v", err))
						}

						if err := os.Remove(tmpFileOut.Name()); err != nil {
							panic(fmt.Errorf("could not remove: %+v", err))
						}
					}()
					_, err = io.Copy(tmpFileOut, reader)
					if err != nil {
						gologger.Error().Msgf("%s\n", err)
						// error while elaborating the file
						request.options.Progress.IncrementFailedRequestsBy(1)
						return
					}
					_ = tmpFileOut.Sync()
					// rewind the file
					_, _ = tmpFileOut.Seek(0, 0)
					event, fileMatches, err := request.processReader(tmpFileOut, filePath, input, fileStat.Size(), previous)
					if err != nil {

View on GitHub (pinned to 265b3a3dec)

When it happens

Trigger: Thrown at pkg/protocols/file/request.go:160 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15). Data as JSON: /api/errors/72720b7963d4faf3. Report an issue: GitHub.