{"record":{"id":"264cac09059af242","repo":"paperclipai/paperclip","slug":"package-is-too-large-to-zip-in-memory-zip64-archi","errorCode":null,"errorMessage":"Package is too large to zip in memory (zip64 archives are not supported).","messagePattern":"Package is too large to zip in memory \\(zip64 archives are not supported\\)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/zip.ts","lineNumber":94,"sourceCode":"\n    const centralHeader = new Uint8Array(46 + fileName.length);\n    writeUint32(centralHeader, 0, 0x02014b50);\n    writeUint16(centralHeader, 4, 20);\n    writeUint16(centralHeader, 6, 20);\n    writeUint16(centralHeader, 8, 0x0800);\n    writeUint16(centralHeader, 10, 0);\n    writeUint32(centralHeader, 16, checksum);\n    writeUint32(centralHeader, 20, body.length);\n    writeUint32(centralHeader, 24, body.length);\n    writeUint16(centralHeader, 28, fileName.length);\n    writeUint32(centralHeader, 42, localOffset);\n    centralHeader.set(fileName, 46);\n\n    localChunks.push(localHeader, body);\n    centralChunks.push(centralHeader);\n    localOffset += localHeader.length + body.length;\n    if (body.length > ZIP_MAX_OFFSET_BYTES || localOffset > ZIP_MAX_OFFSET_BYTES) {\n      throw new Error(\"Package is too large to zip in memory (zip64 archives are not supported).\");\n    }\n  }\n\n  const centralDirectoryLength = centralChunks.reduce((sum, chunk) => sum + chunk.length, 0);\n  const archive = new Uint8Array(localOffset + centralDirectoryLength + 22);\n  let offset = 0;\n  for (const chunk of localChunks) {\n    archive.set(chunk, offset);\n    offset += chunk.length;\n  }\n  const centralDirectoryOffset = offset;\n  for (const chunk of centralChunks) {\n    archive.set(chunk, offset);\n    offset += chunk.length;\n  }\n  writeUint32(archive, offset, 0x06054b50);\n  writeUint16(archive, offset + 8, entries.length);\n  writeUint16(archive, offset + 10, entries.length);","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/client/zip.ts#L76-L112","documentation":"Thrown by createStoredZipArchive (zip.ts:94) when either a single file body or the running local-header offset exceeds ZIP_MAX_OFFSET_BYTES (0xffffffff ≈ 4 GiB). Classic zip uses 32-bit offset fields; without zip64 support the writer refuses to emit an archive it cannot address.","triggerScenarios":"Packaging a single file larger than 4 GiB, or a set of files whose cumulative stored size exceeds 4 GiB. STORE (no compression) means body bytes map 1:1 to archive bytes.","commonSituations":"Including large binaries, datasets, media, or build artifacts in the portability bundle; the in-memory writer is not designed for multi-GiB packages.","solutions":["Exclude large binary files from the bundle or upload them out-of-band.","Keep the total package size well under 4 GiB.","If a single file is >4 GiB, it must be split or excluded; the format cannot represent it."],"exampleFix":"// before: bundle everything including a 5GiB dataset\n// after: filter out large blobs before createStoredZipArchive\nconst files = filterLargeFiles(allFiles, { maxBytes: 100 * 1024 * 1024 });","handlingStrategy":"validation","validationCode":"const ZIP_MAX_OFFSET_BYTES = 0xffffffff;\nfunction safeForZipSize(files: Record<string, Uint8Array>): boolean {\n  let total = 0;\n  for (const body of Object.values(files)) {\n    if (body.length > ZIP_MAX_OFFSET_BYTES) return false;\n    total += body.length;\n    if (total > ZIP_MAX_OFFSET_BYTES) return false;\n  }\n  return true;\n}\n\nif (!safeForZipSize(files)) {\n  throw new Error('Total package size exceeds the 4GiB classic-zip limit.');\n}","typeGuard":"function isWithinZipByteLimit(files: Record<string, Uint8Array>): boolean {\n  let total = 0;\n  for (const body of Object.values(files)) {\n    if (body.length > 0xffffffff) return false;\n    total += body.length;\n    if (total > 0xffffffff) return false;\n  }\n  return true;\n}","tryCatchPattern":null,"preventionTips":["Exclude large binaries and datasets from the bundle.","Sum file sizes before zipping and reject early if near 4 GiB.","Upload very large assets out-of-band rather than through the portability zip."],"tags":["cli","zip","limits","memory","portability-import"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}