{"record":{"id":"9ce0103546fe3138","repo":"golang/go","slug":"zip-file-closed-twice","errorCode":null,"errorMessage":"zip: file closed twice","messagePattern":"zip: file closed twice","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/archive/zip/writer.go","lineNumber":644,"sourceCode":"\tcompCount *countWriter\n\tcrc32     hash.Hash32\n\tclosed    bool\n}\n\nfunc (w *fileWriter) Write(p []byte) (int, error) {\n\tif w.closed {\n\t\treturn 0, errors.New(\"zip: write to closed file\")\n\t}\n\tif w.raw {\n\t\treturn w.zipw.Write(p)\n\t}\n\tw.crc32.Write(p)\n\treturn w.rawCount.Write(p)\n}\n\nfunc (w *fileWriter) close() error {\n\tif w.closed {\n\t\treturn errors.New(\"zip: file closed twice\")\n\t}\n\tw.closed = true\n\tif w.raw {\n\t\treturn w.writeDataDescriptor()\n\t}\n\tif err := w.comp.Close(); err != nil {\n\t\treturn err\n\t}\n\n\t// update FileHeader\n\tfh := w.header.FileHeader\n\tfh.CRC32 = w.crc32.Sum32()\n\tfh.CompressedSize64 = uint64(w.compCount.count)\n\tfh.UncompressedSize64 = uint64(w.rawCount.count)\n\n\tif w.CompressedSize64 > uint32max || w.UncompressedSize64 > uint32max {\n\t\tfh.CompressedSize = uint32max\n\t\tfh.UncompressedSize = uint32max","sourceCodeStart":626,"sourceCodeEnd":662,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/archive/zip/writer.go#L626-L662","documentation":"Error \"zip: file closed twice\" thrown in golang/go.","triggerScenarios":"Thrown at src/archive/zip/writer.go:644 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:17:08.281Z"}