{"record":{"id":"7eefdae660acfe69","repo":"paperclipai/paperclip","slug":"package-has-too-many-files-to-zip-entries-lengt","errorCode":null,"errorMessage":"Package has too many files to zip (${entries.length}; the zip format caps at ${ZIP_MAX_ENTRIES}).","messagePattern":"Package has too many files to zip \\((.+?); the zip format caps at (.+?)\\)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/zip.ts","lineNumber":55,"sourceCode":"    crc ^= byte;\n    for (let bit = 0; bit < 8; bit += 1) {\n      crc = (crc & 1) === 1 ? (crc >>> 1) ^ 0xedb88320 : crc >>> 1;\n    }\n  }\n  return (crc ^ 0xffffffff) >>> 0;\n}\n\n/**\n * Build a stored (uncompressed) zip of `files` under a single `rootPath/`\n * top-level directory — the layout `readZipArchive` folds back into the\n * inline `{ rootPath, files }` bundle. Entries are written in sorted path\n * order and carry no timestamps, so the same content always produces the\n * same bytes and a re-run resumes its content-addressed transfer.\n */\nexport function createStoredZipArchive(files: Record<string, Uint8Array>, rootPath: string): Uint8Array {\n  const entries = Object.entries(files).sort(([left], [right]) => left.localeCompare(right));\n  if (entries.length > ZIP_MAX_ENTRIES) {\n    throw new Error(`Package has too many files to zip (${entries.length}; the zip format caps at ${ZIP_MAX_ENTRIES}).`);\n  }\n  const encoder = new TextEncoder();\n  const localChunks: Uint8Array[] = [];\n  const centralChunks: Uint8Array[] = [];\n  let localOffset = 0;\n\n  for (const [relativePath, body] of entries) {\n    const fileName = encoder.encode(`${rootPath}/${relativePath}`);\n    const checksum = crc32(body);\n\n    const localHeader = new Uint8Array(30 + fileName.length);\n    writeUint32(localHeader, 0, 0x04034b50);\n    writeUint16(localHeader, 4, 20);\n    writeUint16(localHeader, 6, 0x0800);\n    writeUint16(localHeader, 8, 0);\n    writeUint32(localHeader, 14, checksum);\n    writeUint32(localHeader, 18, body.length);\n    writeUint32(localHeader, 22, body.length);","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/client/zip.ts#L37-L73","documentation":"Thrown by createStoredZipArchive (zip.ts:55) when the number of files exceeds ZIP_MAX_ENTRIES (0xffff = 65535). The CLI writes a classic (non-zip64) STORE archive whose central directory header uses a 16-bit entry count, so more than 65535 entries cannot be represented.","triggerScenarios":"Calling createStoredZipArchive with a files record that has more than 65535 keys, e.g. packaging a large node_modules or a repo with hundreds of thousands of files for the chunked import transfer.","commonSituations":"Importing a large monorepo or a directory with generated artifacts; the portability bundle is meant for reasonably-sized project folders, not full dependency trees.","solutions":["Reduce the file set: exclude node_modules, build output, .git, and large binary assets before zipping.","If you genuinely need >65535 files, split the transfer into multiple archives.","Review the import source filter to ensure only intended files are included."],"exampleFix":"// before: include node_modules\nconst files = collectFiles(root, { exclude: [] });\n// after: exclude heavy dirs\nconst files = collectFiles(root, { exclude: [\"node_modules\", \".git\", \"dist\"] });","handlingStrategy":"validation","validationCode":"const ZIP_MAX_ENTRIES = 0xffff;\nfunction safeForZip(files: Record<string, Uint8Array>): boolean {\n  return Object.keys(files).length <= ZIP_MAX_ENTRIES;\n}\n\nif (!safeForZip(files)) {\n  throw new Error(`Too many files (${Object.keys(files).length}); reduce the set before zipping.`);\n}","typeGuard":"function isWithinZipEntryLimit(files: Record<string, Uint8Array>): boolean {\n  return Object.keys(files).length <= 0xffff;\n}","tryCatchPattern":null,"preventionTips":["Exclude node_modules, .git, and build output before packaging.","Count files before calling createStoredZipArchive and bail early.","Split very large transfers into multiple archives."],"tags":["cli","zip","limits","portability-import"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}