different-ai/openwork · error

Unsupported ZIP compression method ${entry.method} for ${ent

Error message

Unsupported ZIP compression method ${entry.method} for ${entry.name}.

What it means

readZipEntryData only supports stored (method 0) and deflate (method 8) entries. Any other compression method recorded in the central directory (bzip2, LZMA, AES-encrypted pseudo-methods, etc.) is rejected with this error naming the entry and method id.

Source

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

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);
  const extraLength = buffer.readUInt16LE(cursor + 28);
  const dataStart = cursor + 30 + nameLength + extraLength;
  const compressed = buffer.subarray(dataStart, dataStart + entry.compressedSize);
  if (entry.method === 0) return compressed;
  if (entry.method === 8) {
    return zlib.inflateRawSync(compressed, {
      finishFlush: zlib.constants.Z_SYNC_FLUSH,
      maxOutputLength: MAX_ENTRY_UNCOMPRESSED_BYTES,
    });
  }
  throw new Error(`Unsupported ZIP compression method ${entry.method} for ${entry.name}.`);
}

function isSafeArchivePath(name) {
  if (!name || name.startsWith("/") || /^[A-Za-z]:/.test(name)) return false;
  const normalized = normalizeZipPath(name);
  return !normalized.split("/").some((part) => part === ".." || part === "");
}

function defaultOpenworkConfig(targetDir, preset = "starter") {
  return {
    version: 1,
    workspace: {
      name: path.basename(targetDir) || "Workspace",
      createdAt: nowMs(),
      preset,
    },
    authorizedRoots: [targetDir],
    reload: null,

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Repack the archive with standard deflate: `zip -Z deflate` or re-run exportWorkspaceConfig
  2. Remove encryption — export a plaintext workspace archive instead
  3. Extract with an external tool and re-zip only the supported entries (opencode.json, .opencode/)

Example fix

// before
7z a -m0=lzma ws.zip .opencode/  # method 14 -> throws
// after
7z a -m0=Deflate ws.zip opencode.json .opencode/  # method 8 -> imports
Defensive patterns

Strategy: validation

Validate before calling

// inspect compression methods via `zipinfo -v` before import; only methods 0 (store) and 8 (deflate) are supported

Type guard

function usesSupportedMethod(entry) {
  return entry.method === 0 || entry.method === 8;
}

Try / catch

try {
  await importWorkspaceConfig({ archivePath, targetDir });
} catch (err) {
  if (String(err.message).startsWith('Unsupported ZIP compression method')) {
    // repack archive with standard deflate, then retry
  } else throw err;
}

Prevention

When it happens

Trigger: importWorkspaceConfig on an archive where an entry uses a compression method other than 0 or 8, e.g. `zip -Z bzip2`, 7-Zip with LZMA, or an encrypted AES zip.

Common situations: Re-compressing an export with 7-Zip using non-deflate codecs; archives encrypted with zip crypto/AES (methods 99/51); legacy tools producing implode/shrink entries.

Related errors


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