{"record":{"id":"1dd5a4660cc54b77","repo":"overleaf/overleaf","slug":"error-getting-bytes-of-zip","errorCode":null,"errorMessage":"error getting bytes of zip","messagePattern":"error getting bytes of zip","errorType":"exception","errorClass":"InvalidZipFileError","httpStatus":null,"severity":"error","filePath":"services/web/app/src/Features/Uploads/ArchiveManager.mjs","lineNumber":118,"sourceCode":"          if (\n            Number.isFinite(Settings.maxEntitiesPerProject) &&\n            projectEntryCount > Settings.maxEntitiesPerProject\n          ) {\n            zipfile.close()\n            return done(null, true) // too many files in zip file\n          }\n        }\n\n        zipfile.readEntry()\n      })\n\n      // no more entries to read\n      zipfile.on('end', () => {\n        if (!Number.isFinite(totalSizeInBytes)) {\n          logger.warn(\n            { source, totalSizeInBytes },\n            'error getting bytes of zip'\n          )\n          return done(new InvalidZipFileError({ info: { totalSizeInBytes } }))\n        }\n        done(null, false)\n      })\n    })\n  })\n}\n\nfunction _extractZipFiles(source, destination) {\n  return new Promise((resolve, reject) => {\n    let settled = false\n    const done = err => {\n      if (settled) return\n      settled = true\n      if (err) reject(err)\n      else resolve()\n    }\n","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/overleaf/overleaf/blob/28ad3b03b71cb4311decdcb55c36b33ec10d72db/services/web/app/src/Features/Uploads/ArchiveManager.mjs#L100-L136","documentation":"Final-tally guard in _isZipTooLarge: the zip's 'end' event fired but totalSizeInBytes was never set to a finite number, meaning no entry reported a usable size (malformed archive or entries with missing uncompressed-size metadata). Unable to prove the zip is within limits, the code rejects it as an InvalidZipFileError rather than risk an unbounded extraction.","triggerScenarios":"Thrown at services/web/app/src/Features/Uploads/ArchiveManager.mjs:118 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reject the upload with the invalid-zip user message","Repack or repair the archive client-side before re-uploading","Correlate the warned source with the producer if certain tools generate such zips"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"28ad3b03b71cb4311decdcb55c36b33ec10d72db","analyzedAt":"2026-09-03T02:10:22.807Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}