different-ai/openwork · error

Failed to find ZIP central directory.

Error message

Failed to find ZIP central directory.

What it means

Error "Failed to find ZIP central directory." thrown in different-ai/openwork.

Source

Thrown at apps/desktop/electron/workspace-archive.mjs:184

    const local = localFileHeader(nameBuffer, data, checksum);
    chunks.push(local, nameBuffer, data);
    central.push(centralDirectoryHeader(nameBuffer, data, checksum, offset), nameBuffer);
    offset += local.length + nameBuffer.length + data.length;
  }

  const centralOffset = offset;
  const centralSize = central.reduce((sum, chunk) => sum + chunk.length, 0);
  chunks.push(...central, endOfCentralDirectory(files.length, centralSize, centralOffset));
  await mkdir(path.dirname(outputPath), { recursive: true });
  await writeFile(outputPath, Buffer.concat(chunks));
}

function findEndOfCentralDirectory(buffer) {
  const start = Math.max(0, buffer.length - 0xffff - 22);
  for (let offset = buffer.length - 22; offset >= start; offset -= 1) {
    if (buffer.readUInt32LE(offset) === ZIP_END_OF_CENTRAL_DIRECTORY) return offset;
  }
  throw new Error("Failed to find ZIP central directory.");
}

function listZipEntries(buffer) {
  if (buffer.byteLength > MAX_ARCHIVE_BYTES) throw new Error("Workspace archive is too large.");
  const eocd = findEndOfCentralDirectory(buffer);
  const count = buffer.readUInt16LE(eocd + 10);
  if (count > MAX_ARCHIVE_ENTRIES) throw new Error("Workspace archive contains too many entries.");
  const centralOffset = buffer.readUInt32LE(eocd + 16);
  const entries = [];
  let totalUncompressed = 0;
  let cursor = centralOffset;
  for (let i = 0; i < count; i += 1) {
    if (buffer.readUInt32LE(cursor) !== ZIP_CENTRAL_DIRECTORY_HEADER) {
      throw new Error("Invalid ZIP central directory entry.");
    }
    const method = buffer.readUInt16LE(cursor + 10);
    const compressedSize = buffer.readUInt32LE(cursor + 20);
    const uncompressedSize = buffer.readUInt32LE(cursor + 24);

View on GitHub (pinned to 2b7df46e8a)

When it happens

Trigger: Thrown at apps/desktop/electron/workspace-archive.mjs:184 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/6fb4f023c8134fa9. Report an issue: GitHub.