paperclipai/paperclip · error

Invalid zip archive: unsupported local file header.

Error message

Invalid zip archive: unsupported local file header.

What it means

Browser zip reader structural validation: while walking local file headers, a 4-byte signature appeared that is neither a local file header (0x04034b50) nor a central-directory/EOCD marker, so the bytes are not a zip the reader can walk. Typically a corrupt download or a non-zip file renamed to .zip.

Source

Thrown at ui/src/lib/zip.ts:193

  const body = new Uint8Array(bytes.byteLength);
  body.set(bytes);
  const stream = new Blob([body]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
  return new Uint8Array(await new Response(stream).arrayBuffer());
}

export async function readZipArchive(source: ArrayBuffer | Uint8Array): Promise<{
  rootPath: string | null;
  files: Record<string, CompanyPortabilityFileEntry>;
}> {
  const bytes = source instanceof Uint8Array ? source : new Uint8Array(source);
  const entries: Array<{ path: string; body: CompanyPortabilityFileEntry }> = [];
  let offset = 0;

  while (offset + 4 <= bytes.length) {
    const signature = readUint32(bytes, offset);
    if (signature === 0x02014b50 || signature === 0x06054b50) break;
    if (signature !== 0x04034b50) {
      throw new Error("Invalid zip archive: unsupported local file header.");
    }

    if (offset + 30 > bytes.length) {
      throw new Error("Invalid zip archive: truncated local file header.");
    }

    const generalPurposeFlag = readUint16(bytes, offset + 6);
    const compressionMethod = readUint16(bytes, offset + 8);
    const compressedSize = readUint32(bytes, offset + 18);
    const fileNameLength = readUint16(bytes, offset + 26);
    const extraFieldLength = readUint16(bytes, offset + 28);

    if ((generalPurposeFlag & 0x0008) !== 0) {
      throw new Error("Unsupported zip archive: data descriptors are not supported.");
    }

    const nameOffset = offset + 30;
    const bodyOffset = nameOffset + fileNameLength + extraFieldLength;

View on GitHub (pinned to 120ae5428f)

Solutions

  1. Provide a valid zip archive; the file appears corrupt or not a real zip. Re-export and retry.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at ui/src/lib/zip.ts:193 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/d05d68cd46dd76a2. Report an issue: GitHub.