{"record":{"id":"6d564c1392bc13fb","repo":"chatboxai/chatbox","slug":"zip-entry-is-too-large-entry-name","errorCode":null,"errorMessage":"ZIP entry is too large: ${entry.name}","messagePattern":"ZIP entry is too large: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/renderer/packages/backup/zip.ts","lineNumber":230,"sourceCode":"  await validateZipEndOfCentralDirectory(file)\n  const limits = { ...DEFAULT_ZIP_LIMITS, ...options.limits }\n  const seenPaths = new Set<string>()\n  const pendingHandlers: Promise<void>[] = []\n  let entryCount = 0\n  let totalUncompressedBytes = 0\n  let fatalError: unknown\n\n  const unzip = new Unzip((entry) => {\n    try {\n      throwIfAborted(options.signal)\n      assertSafeArchivePath(entry.name)\n      if (seenPaths.has(entry.name)) throw new Error(`Duplicate ZIP entry: ${entry.name}`)\n      seenPaths.add(entry.name)\n      entryCount++\n      if (entryCount > limits.maxEntries) throw new Error('ZIP contains too many entries')\n      const entryLimits = { ...limits, ...options.entryLimits?.(entry.name) }\n      if (entry.originalSize !== undefined && entry.originalSize > entryLimits.maxEntryUncompressedBytes) {\n        throw new Error(`ZIP entry is too large: ${entry.name}`)\n      }\n      if (\n        entry.size !== undefined &&\n        entry.originalSize !== undefined &&\n        entry.originalSize > 1024 * 1024 &&\n        entry.originalSize > Math.max(1, entry.size) * entryLimits.maxCompressionRatio\n      ) {\n        throw new Error(`ZIP entry compression ratio is unsafe: ${entry.name}`)\n      }\n\n      const chunks: Uint8Array[] = []\n      let entryBytes = 0\n      entry.ondata = (error, data, final) => {\n        if (fatalError) return\n        if (error) {\n          fatalError = error\n          return\n        }","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/chatboxai/chatbox/blob/81571269addb6bafb589a920b2883f1e1e084fd1/src/renderer/packages/backup/zip.ts#L212-L248","documentation":"Thrown when an entry declares entry.originalSize greater than entryLimits.maxEntryUncompressedBytes (default 512 MiB). entryLimits is the global limit optionally narrowed per-path via options.entryLimits(name). The check uses the header-declared uncompressed size, so it aborts before inflating the payload.","triggerScenarios":"A single entry whose declared uncompressed size exceeds 512 MiB (or a per-path override), or an archive containing a large media blob/log that the backup importer does not expect.","commonSituations":"Backups bundling large video/attachment files, a single huge log/database blob, or a zip-bomb entry sized to exhaust memory.","solutions":["If large entries are expected for specific paths, raise the cap via options.entryLimits for those paths.","Raise limits.maxEntryUncompressedBytes globally for trusted full backups.","Exclude oversized blobs from the export on the producer side."],"exampleFix":"// before\nawait readZipFileEntries(file, onEntry)\n\n// after: allow large media paths while keeping the default elsewhere\nawait readZipFileEntries(file, onEntry, {\n  entryLimits: (path) =>\n    path.startsWith('attachments/')\n      ? { maxEntryUncompressedBytes: 2 * 1024 * 1024 * 1024 }\n      : {}\n})","handlingStrategy":"validation","validationCode":"// Raise the per-entry cap globally or per-path via entryLimits.\nawait readZipFileEntries(file, onEntry, {\n  limits: { maxEntryUncompressedBytes: 2 * 1024 * 1024 * 1024 },\n  entryLimits: (path) =>\n    path.startsWith('attachments/')\n      ? { maxEntryUncompressedBytes: 4 * 1024 * 1024 * 1024 }\n      : {},\n})","typeGuard":null,"tryCatchPattern":"try {\n  await readZipFileEntries(file, onEntry, opts)\n} catch (error) {\n  if (error instanceof Error && error.message.startsWith('ZIP entry is too large')) {\n    reportToUser('One file in the backup exceeds the size limit.')\n  } else throw error\n}","preventionTips":["Set entryLimits per path so large-but-legitimate blobs (attachments/media) get a higher cap than default.","Exclude oversized blobs at export time when possible.","Document the configured cap to users so they know what to expect."],"tags":["zip","backup","limits","zip-bomb","memory"],"backgroundTag":null,"analyzedSha":"81571269addb6bafb589a920b2883f1e1e084fd1","analyzedAt":"2026-08-12T21:51:44.981Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}