different-ai/openwork · error

Workspace archive contains too much uncompressed data.

Error message

Workspace archive contains too much uncompressed data.

What it means

listZipEntries sums the declared uncompressedSize of every central-directory entry and enforces a 64 MiB total (MAX_TOTAL_UNCOMPRESSED_BYTES). When the cumulative size exceeds the cap, the whole archive is rejected before any entry is extracted, protecting against zip bombs and decompression blowups.

Source

Thrown at apps/desktop/electron/workspace-archive.mjs:205

function listZipEntries(buffer) {
  if (buffer.byteLength > MAX_ARCHIVE_BYTES) throw new Error("Workspace archive is too large.");
  const eocd = findEndOfCentralDirectory(buffer);
  const count = buffer.readUInt16LE(eocd + 10);
  if (count > MAX_ARCHIVE_ENTRIES) throw new Error("Workspace archive contains too many entries.");
  const centralOffset = buffer.readUInt32LE(eocd + 16);
  const entries = [];
  let totalUncompressed = 0;
  let cursor = centralOffset;
  for (let i = 0; i < count; i += 1) {
    if (buffer.readUInt32LE(cursor) !== ZIP_CENTRAL_DIRECTORY_HEADER) {
      throw new Error("Invalid ZIP central directory entry.");
    }
    const method = buffer.readUInt16LE(cursor + 10);
    const compressedSize = buffer.readUInt32LE(cursor + 20);
    const uncompressedSize = buffer.readUInt32LE(cursor + 24);
    if (uncompressedSize > MAX_ENTRY_UNCOMPRESSED_BYTES) throw new Error(`Archive entry exceeds the ${MAX_ENTRY_UNCOMPRESSED_BYTES}-byte limit.`);
    totalUncompressed += uncompressedSize;
    if (totalUncompressed > MAX_TOTAL_UNCOMPRESSED_BYTES) throw new Error("Workspace archive contains too much uncompressed data.");
    const nameLength = buffer.readUInt16LE(cursor + 28);
    const extraLength = buffer.readUInt16LE(cursor + 30);
    const commentLength = buffer.readUInt16LE(cursor + 32);
    const localOffset = buffer.readUInt32LE(cursor + 42);
    const name = buffer.toString("utf8", cursor + 46, cursor + 46 + nameLength);
    entries.push({ name, method, compressedSize, uncompressedSize, localOffset });
    cursor += 46 + nameLength + extraLength + commentLength;
  }
  return entries;
}

function readZipEntryData(buffer, entry) {
  if (entry.uncompressedSize > MAX_ENTRY_UNCOMPRESSED_BYTES) throw new Error(`Archive entry exceeds the ${MAX_ENTRY_UNCOMPRESSED_BYTES}-byte limit.`);
  const cursor = entry.localOffset;
  if (buffer.readUInt32LE(cursor) !== ZIP_LOCAL_FILE_HEADER) {
    throw new Error(`Invalid ZIP local header for ${entry.name}.`);
  }
  const nameLength = buffer.readUInt16LE(cursor + 26);

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Trim the archive so total uncompressed content stays under 64 MiB
  2. Split the workspace into multiple smaller archives and import selectively
  3. Remove large binaries from .opencode/ and re-export the workspace
  4. Verify with `unzip -l archive.zip` that the summed uncompressed size is under 64 MiB before importing

Example fix

// before
unzip -l ws.zip  # total 90000 KB -> throws
// after
zip -d ws.zip '.opencode/assets/*'  # total now 21000 KB -> imports
Defensive patterns

Strategy: validation

Validate before calling

import { execFile } from 'node:child_process';
function totalUncompressedUnder64MiB(zipListingBytes) {
  return zipListingBytes <= 64 * 1024 * 1024;
}

Type guard

function isWithinTotalLimit(entries) {
  return Array.isArray(entries) &&
    entries.reduce((sum, e) => sum + (e.uncompressedSize || 0), 0) <= 64 * 1024 * 1024;
}

Try / catch

try {
  await importWorkspaceConfig({ archivePath, targetDir });
} catch (err) {
  if (err.message === 'Workspace archive contains too much uncompressed data.') {
    // split or trim the archive and retry with a smaller one
  } else throw err;
}

Prevention

When it happens

Trigger: importWorkspaceConfig on an archive whose combined declared uncompressed sizes across all entries exceed 67108864 bytes (64 MiB), even if each individual entry is under 16 MiB.

Common situations: Aggregating many medium config/asset files into one workspace export; an archive accumulated over time with lots of .opencode/ data; crafted archives that pass the per-entry check but exceed total budget.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/5ccb06d1e700ccd1. Report an issue: GitHub.