vercel-labs/skills · error · Error

Multi-disk zip archives are not supported

Error message

Multi-disk zip archives are not supported

What it means

The zip end-of-central-directory record contains disk-number fields. This library only supports single-disk archives, so if the 'disk number' or 'central directory disk' fields are non-zero, or the per-disk entry count differs from the total entry count, it throws this error. Multi-disk (spanned/split) zips are rare and produced only by old or specialized tools.

Source

Thrown at src/archive.ts:90

  offset: number;
  size: number;
  trailerOffset: number;
} {
  const diskNumber = buffer.readUInt16LE(endOffset + 4);
  const centralDirectoryDisk = buffer.readUInt16LE(endOffset + 6);
  const entriesOnDisk = buffer.readUInt16LE(endOffset + 8);
  const totalEntries = buffer.readUInt16LE(endOffset + 10);
  const size = buffer.readUInt32LE(endOffset + 12);
  const offset = buffer.readUInt32LE(endOffset + 16);
  const usesZip64 =
    entriesOnDisk === 0xffff ||
    totalEntries === 0xffff ||
    size === 0xffffffff ||
    offset === 0xffffffff;

  if (!usesZip64) {
    if (diskNumber !== 0 || centralDirectoryDisk !== 0 || entriesOnDisk !== totalEntries) {
      throw new Error('Multi-disk zip archives are not supported');
    }
    return { entries: totalEntries, offset, size, trailerOffset: endOffset };
  }

  if (diskNumber !== 0 || centralDirectoryDisk !== 0) {
    throw new Error('Multi-disk zip archives are not supported');
  }

  const locatorOffset = endOffset - 20;
  ensureRange(buffer, locatorOffset, 20, 'zip64 locator');
  if (buffer.readUInt32LE(locatorOffset) !== ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR) {
    throw new Error('Invalid zip64 locator');
  }
  if (
    buffer.readUInt32LE(locatorOffset + 4) !== 0 ||
    buffer.readUInt32LE(locatorOffset + 16) !== 1
  ) {
    throw new Error('Multi-disk zip archives are not supported');

View on GitHub (pinned to 435076e789)

Solutions

  1. Reassemble split archives into a single file first: `zip -s 0 archive.zip --out full.zip` (or `zip -FF` to fix), then parse the merged file.
  2. Re-download or re-create the archive; a single-disk tool (standard `zip`, `Compress-Archive`, etc.) never sets these fields.
  3. If you only have the final segment, extract with a tool that supports spanning instead of this library, then repackage as a single-disk zip.

Example fix

# before (passing only the last part of a split set)
unzip -t archive.zip   # multi-disk errors

# after: merge parts into one archive first
zip -s 0 archive.zip --out archive-full.zip
# then parse archive-full.zip
Defensive patterns

Strategy: validation

Validate before calling

function isSingleDisk(buffer: Buffer, eocd: number): boolean {
  return buffer.readUInt16LE(eocd + 4) === 0 && buffer.readUInt16LE(eocd + 6) === 0;
}

Type guard

null

Try / catch

try {
  const zip = readZipArchive(buffer);
} catch (e) {
  if ((e as Error).message === 'Multi-disk zip archives are not supported') {
    // ask sender for a merged/single-disk archive
  }
  throw e;
}

Prevention

When it happens

Trigger: Parsing a spanned/split zip archive (e.g. created with `zip -s` or PKZIP split mode) where diskNumber or centralDirectoryDisk is > 0; a corrupt record where these bytes happen to be non-zero; an archive concatenated in a way that misaligns the end record so garbage is read as disk fields.

Common situations: Users receiving multi-part archives (.z01, .z02, ... .zip) and passing only the final .zip segment to the parser; legacy PKZIP split output; byte-corruption during transfer flipping the disk number field.

Related errors


AI-assisted analysis of vercel-labs/skills@435076e789 (2026-08-28). Data as JSON: /api/errors/d1b3622216696122. Report an issue: GitHub.