paperclipai/paperclip · error · Error

Package has too many files to zip (${entries.length}; the zi

Error message

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

What it means

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.

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 67001ec6eb)

Solutions

  1. Reduce the file set: exclude node_modules, build output, .git, and large binary assets before zipping.
  2. If you genuinely need >65535 files, split the transfer into multiple archives.
  3. Review the import source filter to ensure only intended files are included.

Example fix

// before: include node_modules
const files = collectFiles(root, { exclude: [] });
// after: exclude heavy dirs
const files = collectFiles(root, { exclude: ["node_modules", ".git", "dist"] });
Defensive patterns

Strategy: validation

Validate before calling

const ZIP_MAX_ENTRIES = 0xffff;
function safeForZip(files: Record<string, Uint8Array>): boolean {
  return Object.keys(files).length <= ZIP_MAX_ENTRIES;
}

if (!safeForZip(files)) {
  throw new Error(`Too many files (${Object.keys(files).length}); reduce the set before zipping.`);
}

Type guard

function isWithinZipEntryLimit(files: Record<string, Uint8Array>): boolean {
  return Object.keys(files).length <= 0xffff;
}

Prevention

When it happens

Trigger: 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.

Common situations: Importing a large monorepo or a directory with generated artifacts; the portability bundle is meant for reasonably-sized project folders, not full dependency trees.

Related errors


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