{"record":{"id":"19741716a963fbaa","repo":"golang/go","slug":"archive-zip-invalid-duplicate-fileheader","errorCode":null,"errorMessage":"archive/zip: invalid duplicate FileHeader","messagePattern":"archive/zip: invalid duplicate FileHeader","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/archive/zip/writer.go","lineNumber":280,"sourceCode":"\t\t\t\treturn false, false\n\t\t\t}\n\t\t\trequire = true\n\t\t}\n\t}\n\treturn true, require\n}\n\n// prepare performs the bookkeeping operations required at the start of\n// CreateHeader and CreateRaw.\nfunc (w *Writer) prepare(fh *FileHeader) error {\n\tif w.last != nil && !w.last.closed {\n\t\tif err := w.last.close(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif len(w.dir) > 0 && w.dir[len(w.dir)-1].FileHeader == fh {\n\t\t// See https://golang.org/issue/11144 confusion.\n\t\treturn errors.New(\"archive/zip: invalid duplicate FileHeader\")\n\t}\n\treturn nil\n}\n\n// CreateHeader adds a file to the zip archive using the provided [FileHeader]\n// for the file metadata. [Writer] takes ownership of fh and may mutate\n// its fields. The caller must not modify fh after calling [Writer.CreateHeader].\n//\n// This returns a [Writer] to which the file contents should be written.\n// The file's contents must be written to the io.Writer before the next\n// call to [Writer.Create], [Writer.CreateHeader], [Writer.CreateRaw], or [Writer.Close].\nfunc (w *Writer) CreateHeader(fh *FileHeader) (io.Writer, error) {\n\tif err := w.prepare(fh); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The ZIP format has a sad state of affairs regarding character encoding.\n\t// Officially, the name and comment fields are supposed to be encoded","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/archive/zip/writer.go#L262-L298","documentation":"Error \"archive/zip: invalid duplicate FileHeader\" thrown in golang/go.","triggerScenarios":"Thrown at src/archive/zip/writer.go:280 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}