paperclipai/paperclip · error · Error

Package has too many files to zip

Error message

Package has too many files to zip (${entries.length}; the zip format caps at ${ZIP_MAX_ENTRIES}).

What it means

createStoredZipArchive counts entries against the zip format's hard entry limit; too many files means the package cannot be represented as a single non-zip64 archive.

Solutions

  1. Reduce the number of files in the package below the zip entry cap.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cli/src/commands/client/zip.ts:55 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18). Data as JSON: /api/errors/7eefdae660acfe69. Report an issue: GitHub.

Appendix: source

Thrown at cli/src/commands/client/zip.ts:55

    crc ^= byte;
    for (let bit = 0; bit < 8; bit += 1) {
      crc = (crc & 1) === 1 ? (crc >>> 1) ^ 0xedb88320 : crc >>> 1;
    }
  }
  return (crc ^ 0xffffffff) >>> 0;
}

/**
 * Build a stored (uncompressed) zip of `files` under a single `rootPath/`
 * top-level directory — the layout `readZipArchive` folds back into the
 * inline `{ rootPath, files }` bundle. Entries are written in sorted path
 * order and carry no timestamps, so the same content always produces the
 * same bytes and a re-run resumes its content-addressed transfer.
 */
export function createStoredZipArchive(files: Record<string, Uint8Array>, rootPath: string): Uint8Array {
  const entries = Object.entries(files).sort(([left], [right]) => left.localeCompare(right));
  if (entries.length > ZIP_MAX_ENTRIES) {
    throw new Error(`Package has too many files to zip (${entries.length}; the zip format caps at ${ZIP_MAX_ENTRIES}).`);
  }
  const encoder = new TextEncoder();
  const localChunks: Uint8Array[] = [];
  const centralChunks: Uint8Array[] = [];
  let localOffset = 0;

  for (const [relativePath, body] of entries) {
    const fileName = encoder.encode(`${rootPath}/${relativePath}`);
    const checksum = crc32(body);

    const localHeader = new Uint8Array(30 + fileName.length);
    writeUint32(localHeader, 0, 0x04034b50);
    writeUint16(localHeader, 4, 20);
    writeUint16(localHeader, 6, 0x0800);
    writeUint16(localHeader, 8, 0);
    writeUint32(localHeader, 14, checksum);
    writeUint32(localHeader, 18, body.length);
    writeUint32(localHeader, 22, body.length);

View on GitHub (pinned to 120ae5428f)