{"record":{"id":"5ed8021552a20bb5","repo":"different-ai/openwork","slug":"workspace-archive-contains-too-many-entries","errorCode":null,"errorMessage":"Workspace archive contains too many entries.","messagePattern":"Workspace archive contains too many entries\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/desktop/electron/workspace-archive.mjs","lineNumber":191,"sourceCode":"  const centralSize = central.reduce((sum, chunk) => sum + chunk.length, 0);\n  chunks.push(...central, endOfCentralDirectory(files.length, centralSize, centralOffset));\n  await mkdir(path.dirname(outputPath), { recursive: true });\n  await writeFile(outputPath, Buffer.concat(chunks));\n}\n\nfunction findEndOfCentralDirectory(buffer) {\n  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);","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/desktop/electron/workspace-archive.mjs#L173-L209","documentation":"Error \"Workspace archive contains too many entries.\" thrown in different-ai/openwork.","triggerScenarios":"Thrown at apps/desktop/electron/workspace-archive.mjs:191 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"}