paperclipai/paperclip · error · Error

Invalid zip archive: central directory references a missing

Error message

Invalid zip archive: central directory references a missing local entry.

What it means

Error "Invalid zip archive: central directory references a missing local entry." thrown in paperclipai/paperclip.

Source

Thrown at packages/shared/src/portability-zip.ts:111

  if (centralDirectoryStart > eocdOffset || centralDirectoryStart + centralDirectorySize !== eocdOffset) {
    throw new Error(
      "Invalid zip archive: central directory location is inconsistent (truncated or forged).",
    );
  }

  const directoryEnd = centralDirectoryStart + centralDirectorySize;
  let cursor = centralDirectoryStart;
  let recordCount = 0;
  while (cursor < directoryEnd) {
    if (cursor + 46 > directoryEnd || readUint32(bytes, cursor) !== CENTRAL_DIRECTORY_SIGNATURE) {
      throw new Error("Invalid zip archive: malformed central directory record.");
    }
    const fileNameLength = readUint16(bytes, cursor + 28);
    const extraFieldLength = readUint16(bytes, cursor + 30);
    const commentLength = readUint16(bytes, cursor + 32);
    const localHeaderOffset = readUint32(bytes, cursor + 42);
    if (localHeaderOffset + 4 > bytes.length || readUint32(bytes, localHeaderOffset) !== LOCAL_FILE_SIGNATURE) {
      throw new Error("Invalid zip archive: central directory references a missing local entry.");
    }
    cursor += 46 + fileNameLength + extraFieldLength + commentLength;
    recordCount += 1;
  }

  if (cursor !== directoryEnd) {
    throw new Error("Invalid zip archive: central directory size does not match its records.");
  }
  if (recordCount !== declaredEntryCount || recordCount !== localHeaderCount) {
    throw new Error(
      `Invalid zip archive: central directory declares ${declaredEntryCount} entries but ${localHeaderCount} local entries were read (truncated or corrupt).`,
    );
  }
}

function sharedArchiveRoot(paths: string[]) {
  if (paths.length === 0) return null;
  const firstSegments = paths

View on GitHub (pinned to 120ae5428f)

Solutions

  1. Re-create the archive; the central directory references entries missing from the file.

When it happens

Trigger: Thrown at packages/shared/src/portability-zip.ts:111 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18). Data as JSON: /api/errors/5b7e46622fb8d8e6. Report an issue: GitHub.