vercel-labs/skills · error · Error

Invalid zip64 end of central directory

Error message

Invalid zip64 end of central directory

What it means

After following the locator, the parser expects the zip64 end-of-central-directory record to begin with the ZIP64_END_OF_CENTRAL_DIRECTORY signature. A mismatch means the bytes at the recorded offset are not actually a zip64 end record — the file is corrupt, the offset is wrong, or the locator was a false positive.

Source

Thrown at src/archive.ts:114

    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');
  }

  const zip64EndOffset = readUInt64AsNumber(buffer, locatorOffset + 8, 'zip64 end offset');
  ensureRange(buffer, zip64EndOffset, 56, 'zip64 end of central directory');
  if (buffer.readUInt32LE(zip64EndOffset) !== ZIP64_END_OF_CENTRAL_DIRECTORY) {
    throw new Error('Invalid zip64 end of central directory');
  }

  const recordSize = readUInt64AsNumber(buffer, zip64EndOffset + 4, 'zip64 end size');
  if (recordSize < 44) {
    throw new Error('Invalid zip64 end of central directory');
  }
  ensureRange(buffer, zip64EndOffset, recordSize + 12, 'zip64 end of central directory');
  if (zip64EndOffset + recordSize + 12 !== locatorOffset) {
    throw new Error('Invalid zip64 end of central directory');
  }
  if (
    buffer.readUInt32LE(zip64EndOffset + 16) !== 0 ||
    buffer.readUInt32LE(zip64EndOffset + 20) !== 0
  ) {
    throw new Error('Multi-disk zip archives are not supported');
  }

  const zip64EntriesOnDisk = readUInt64AsNumber(

View on GitHub (pinned to 435076e789)

Solutions

  1. Test and repair with `unzip -t` / `zip -FF file.zip --out fixed.zip`, then parse the fixed file.
  2. Re-download or regenerate the archive from the original source.
  3. If you build archives programmatically, update the zip library to a version with correct zip64 offset writing.

Example fix

# before
readZipArchive(buffer); // throws 'Invalid zip64 end of central directory'

# after
zip -FF broken.zip --out fixed.zip
readZipArchive(await fs.promises.readFile('fixed.zip'));
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

try {
  const zip = readZipArchive(buffer);
} catch (e) {
  if ((e as Error).message === 'Invalid zip64 end of central directory') {
    // run zip -FF repair or re-download
  }
  throw e;
}

Prevention

When it happens

Trigger: The locator's 64-bit offset field points to the wrong location (corruption or buggy writer); appending/prepending data shifted the record without updating offsets; fuzzed input where a fake locator precedes the EOCD.

Common situations: Archives modified after creation (data appended by mail systems, self-extractor stubs) that desync locator offsets; files corrupted in transit; archives produced by zip writers with known zip64 offset bugs.

Related errors


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