paperclipai/paperclip · error · Error

Package is too large to zip in memory (zip64 archives are no

Error message

Package is too large to zip in memory (zip64 archives are not supported).

What it means

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.

Source

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

    const centralHeader = new Uint8Array(46 + fileName.length);
    writeUint32(centralHeader, 0, 0x02014b50);
    writeUint16(centralHeader, 4, 20);
    writeUint16(centralHeader, 6, 20);
    writeUint16(centralHeader, 8, 0x0800);
    writeUint16(centralHeader, 10, 0);
    writeUint32(centralHeader, 16, checksum);
    writeUint32(centralHeader, 20, body.length);
    writeUint32(centralHeader, 24, body.length);
    writeUint16(centralHeader, 28, fileName.length);
    writeUint32(centralHeader, 42, localOffset);
    centralHeader.set(fileName, 46);

    localChunks.push(localHeader, body);
    centralChunks.push(centralHeader);
    localOffset += localHeader.length + body.length;
    if (body.length > ZIP_MAX_OFFSET_BYTES || localOffset > ZIP_MAX_OFFSET_BYTES) {
      throw new Error("Package is too large to zip in memory (zip64 archives are not supported).");
    }
  }

  const centralDirectoryLength = centralChunks.reduce((sum, chunk) => sum + chunk.length, 0);
  const archive = new Uint8Array(localOffset + centralDirectoryLength + 22);
  let offset = 0;
  for (const chunk of localChunks) {
    archive.set(chunk, offset);
    offset += chunk.length;
  }
  const centralDirectoryOffset = offset;
  for (const chunk of centralChunks) {
    archive.set(chunk, offset);
    offset += chunk.length;
  }
  writeUint32(archive, offset, 0x06054b50);
  writeUint16(archive, offset + 8, entries.length);
  writeUint16(archive, offset + 10, entries.length);

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Exclude large binary files from the bundle or upload them out-of-band.
  2. Keep the total package size well under 4 GiB.
  3. If a single file is >4 GiB, it must be split or excluded; the format cannot represent it.

Example fix

// before: bundle everything including a 5GiB dataset
// after: filter out large blobs before createStoredZipArchive
const files = filterLargeFiles(allFiles, { maxBytes: 100 * 1024 * 1024 });
Defensive patterns

Strategy: validation

Validate before calling

const ZIP_MAX_OFFSET_BYTES = 0xffffffff;
function safeForZipSize(files: Record<string, Uint8Array>): boolean {
  let total = 0;
  for (const body of Object.values(files)) {
    if (body.length > ZIP_MAX_OFFSET_BYTES) return false;
    total += body.length;
    if (total > ZIP_MAX_OFFSET_BYTES) return false;
  }
  return true;
}

if (!safeForZipSize(files)) {
  throw new Error('Total package size exceeds the 4GiB classic-zip limit.');
}

Type guard

function isWithinZipByteLimit(files: Record<string, Uint8Array>): boolean {
  let total = 0;
  for (const body of Object.values(files)) {
    if (body.length > 0xffffffff) return false;
    total += body.length;
    if (total > 0xffffffff) return false;
  }
  return true;
}

Prevention

When it happens

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

Common situations: Including large binaries, datasets, media, or build artifacts in the portability bundle; the in-memory writer is not designed for multi-GiB packages.

Related errors


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