{"record":{"id":"f6f0d5e2f4fefc44","repo":"different-ai/openwork","slug":"invalid-zip-central-directory-entry","errorCode":null,"errorMessage":"Invalid ZIP central directory entry.","messagePattern":"Invalid ZIP central directory entry\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/desktop/electron/workspace-archive.mjs","lineNumber":198,"sourceCode":"  const start = Math.max(0, buffer.length - 0xffff - 22);\n  for (let offset = buffer.length - 22; offset >= start; offset -= 1) {\n    if (buffer.readUInt32LE(offset) === ZIP_END_OF_CENTRAL_DIRECTORY) return offset;\n  }\n  throw new Error(\"Failed to find ZIP central directory.\");\n}\n\nfunction listZipEntries(buffer) {\n  if (buffer.byteLength > MAX_ARCHIVE_BYTES) throw new Error(\"Workspace archive is too large.\");\n  const eocd = findEndOfCentralDirectory(buffer);\n  const count = buffer.readUInt16LE(eocd + 10);\n  if (count > MAX_ARCHIVE_ENTRIES) throw new Error(\"Workspace archive contains too many entries.\");\n  const centralOffset = buffer.readUInt32LE(eocd + 16);\n  const entries = [];\n  let totalUncompressed = 0;\n  let cursor = centralOffset;\n  for (let i = 0; i < count; i += 1) {\n    if (buffer.readUInt32LE(cursor) !== ZIP_CENTRAL_DIRECTORY_HEADER) {\n      throw new Error(\"Invalid ZIP central directory entry.\");\n    }\n    const method = buffer.readUInt16LE(cursor + 10);\n    const compressedSize = buffer.readUInt32LE(cursor + 20);\n    const uncompressedSize = buffer.readUInt32LE(cursor + 24);\n    if (uncompressedSize > MAX_ENTRY_UNCOMPRESSED_BYTES) throw new Error(`Archive entry exceeds the ${MAX_ENTRY_UNCOMPRESSED_BYTES}-byte limit.`);\n    totalUncompressed += uncompressedSize;\n    if (totalUncompressed > MAX_TOTAL_UNCOMPRESSED_BYTES) throw new Error(\"Workspace archive contains too much uncompressed data.\");\n    const nameLength = buffer.readUInt16LE(cursor + 28);\n    const extraLength = buffer.readUInt16LE(cursor + 30);\n    const commentLength = buffer.readUInt16LE(cursor + 32);\n    const localOffset = buffer.readUInt32LE(cursor + 42);\n    const name = buffer.toString(\"utf8\", cursor + 46, cursor + 46 + nameLength);\n    entries.push({ name, method, compressedSize, uncompressedSize, localOffset });\n    cursor += 46 + nameLength + extraLength + commentLength;\n  }\n  return entries;\n}\n","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/desktop/electron/workspace-archive.mjs#L180-L216","documentation":"Error \"Invalid ZIP central directory entry.\" thrown in different-ai/openwork.","triggerScenarios":"Thrown at apps/desktop/electron/workspace-archive.mjs:198 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}