nexu-io/open-design · error · Error

unsupported zip compression method: ${method}

Error message

unsupported zip compression method: ${method}

What it means

Only compression methods 0 (stored) and 8 (deflate) are accepted. Any other method (e.g. 12 Bzip2, 14 LZMA, 93 Zstandard, 95 XZ) throws with the numeric method. Maps to HTTP 400 via the /api/import/claude-design route.

Source

Thrown at apps/daemon/src/design/claude-design-import.ts:209

  const entries: ZipEntry[] = [];
  let offset = centralOffset;
  for (let i = 0; i < entryCount; i += 1) {
    if (zip.readUInt32LE(offset) !== CENTRAL_SIG) {
      throw new Error('invalid zip central directory entry');
    }
    const flags = zip.readUInt16LE(offset + 8);
    const method = zip.readUInt16LE(offset + 10);
    const compressedSize = zip.readUInt32LE(offset + 20);
    const uncompressedSize = zip.readUInt32LE(offset + 24);
    const nameLen = zip.readUInt16LE(offset + 28);
    const extraLen = zip.readUInt16LE(offset + 30);
    const commentLen = zip.readUInt16LE(offset + 32);
    const localOffset = zip.readUInt32LE(offset + 42);
    const name = zip.slice(offset + 46, offset + 46 + nameLen).toString('utf8');
    if ((flags & 1) !== 0) throw new Error('encrypted zip entries are not supported');
    if (method !== 0 && method !== 8) {
      throw new Error(`unsupported zip compression method: ${method}`);
    }
    entries.push({
      name,
      method,
      compressedSize,
      uncompressedSize,
      localOffset,
      isDirectory: name.endsWith('/'),
    });
    offset += 46 + nameLen + extraLen + commentLen;
  }
  return entries;
}

function findEndOfCentralDirectory(zip: Buffer): number {
  const min = Math.max(0, zip.length - 0xffff - 22);
  for (let i = zip.length - 22; i >= min; i -= 1) {
    if (zip.readUInt32LE(i) === EOCD_SIG) return i;

View on GitHub (pinned to 5be4028344)

Solutions

  1. Recreate the zip using deflate (standard `zip` CLI, Finder 'Compress', or Windows 'Send to > Compressed (zipped) folder').
  2. Avoid zstd/xz/bzip2/lzma codecs when archiving for import.
  3. Verify with `unzip -lv file.zip` that the 'Method' column reads 'Stored' or 'Defl:N'.
Defensive patterns

Strategy: validation

Validate before calling

// Confirm every entry uses Stored or Deflate before importing.
import { execFileSync } from 'node:child_process';
function zipUsesOnlyDeflate(file: string): boolean {
  try {
    const out = execFileSync('unzip', ['-lv', file], { encoding: 'utf8' });
    // Method column must be 'Stored' or 'Defl:*' for every entry.
    return !/\b(Bzip2|LZMA|Zstandard|XZ|bz2|lzma|zst|xz)\b/i.test(out);
  } catch {
    return false;
  }
}

Try / catch

try {
  await importClaudeDesignZip(zipPath, projectDir);
} catch (err) {
  if (String(err).includes('unsupported zip compression method')) {
    return res.status(400).json({ error: 're-zip with deflate compression' });
  }
  throw err;
}

Prevention

When it happens

Trigger: A zip entry compressed with a non-deflate codec. importClaudeDesignZip -> readCentralDirectory reads method = zip.readUInt16LE(offset + 10) and method !== 0 && method !== 8 fails.

Common situations: Modern zip tools defaulting to zstd or xz; 7-Zip using LZMA; a re-archiving step that chose a newer codec; Windows 'Compress to ZSTD' shell extensions.

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/d9027f0e55890ef0. Report an issue: GitHub.