{"record":{"id":"db777b7a59cb6ef3","repo":"paperclipai/paperclip","slug":"unsupported-zip-archive-a-stored-entry-exceeds-th","errorCode":null,"errorMessage":"Unsupported zip archive: a stored entry exceeds the ${maxEntryDecompressedBytes}-byte per-entry limit.","messagePattern":"Unsupported zip archive: a stored entry exceeds the (.+?)-byte per-entry limit\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shared/src/portability-zip.ts","lineNumber":185,"sourceCode":"}\n\n// Size caps applied while expanding an archive. Callers use the module defaults;\n// the limits are parameterizable so the guard can be exercised in tests without\n// allocating hundreds of megabytes.\nexport interface ReadZipArchiveLimits {\n  maxEntryDecompressedBytes: number;\n  maxTotalDecompressedBytes: number;\n}\n\nconst DEFAULT_ZIP_LIMITS: ReadZipArchiveLimits = {\n  maxEntryDecompressedBytes: MAX_ZIP_ENTRY_DECOMPRESSED_BYTES,\n  maxTotalDecompressedBytes: MAX_ZIP_TOTAL_DECOMPRESSED_BYTES,\n};\n\nfunction inflateZipEntry(compressionMethod: number, bytes: Uint8Array, maxEntryDecompressedBytes: number) {\n  if (compressionMethod === 0) {\n    if (bytes.length > maxEntryDecompressedBytes) {\n      throw new Error(\n        `Unsupported zip archive: a stored entry exceeds the ${maxEntryDecompressedBytes}-byte per-entry limit.`,\n      );\n    }\n    return bytes;\n  }\n  if (compressionMethod !== 8) {\n    throw new Error(\"Unsupported zip archive: only STORE and DEFLATE entries are supported.\");\n  }\n  try {\n    // maxOutputLength makes zlib throw (ERR_BUFFER_TOO_LARGE) before it allocates\n    // past the per-entry ceiling, so a bomb entry never materializes in memory.\n    return new Uint8Array(inflateRawSync(bytes, { maxOutputLength: maxEntryDecompressedBytes }));\n  } catch (error) {\n    if ((error as NodeJS.ErrnoException | undefined)?.code === \"ERR_BUFFER_TOO_LARGE\") {\n      throw new Error(\n        `Unsupported zip archive: a compressed entry expands beyond the ${maxEntryDecompressedBytes}-byte per-entry limit.`,\n      );\n    }","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/packages/shared/src/portability-zip.ts#L167-L203","documentation":"Error \"Unsupported zip archive: a stored entry exceeds the ${maxEntryDecompressedBytes}-byte per-entry limit.\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at packages/shared/src/portability-zip.ts:185 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Split the archive so each entry is under the per-entry byte limit."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}