{"record":{"id":"999483e4e74342c2","repo":"paperclipai/paperclip","slug":"invalid-zip-archive-central-directory-declares","errorCode":null,"errorMessage":"Invalid zip archive: central directory declares ${declaredEntryCount} entries but ${localHeaderCount} local entries were read (truncated or corrupt).","messagePattern":"Invalid zip archive: central directory declares (.+?) entries but (.+?) local entries were read \\(truncated or corrupt\\)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shared/src/portability-zip.ts","lineNumber":121,"sourceCode":"    if (cursor + 46 > directoryEnd || readUint32(bytes, cursor) !== CENTRAL_DIRECTORY_SIGNATURE) {\n      throw new Error(\"Invalid zip archive: malformed central directory record.\");\n    }\n    const fileNameLength = readUint16(bytes, cursor + 28);\n    const extraFieldLength = readUint16(bytes, cursor + 30);\n    const commentLength = readUint16(bytes, cursor + 32);\n    const localHeaderOffset = readUint32(bytes, cursor + 42);\n    if (localHeaderOffset + 4 > bytes.length || readUint32(bytes, localHeaderOffset) !== LOCAL_FILE_SIGNATURE) {\n      throw new Error(\"Invalid zip archive: central directory references a missing local entry.\");\n    }\n    cursor += 46 + fileNameLength + extraFieldLength + commentLength;\n    recordCount += 1;\n  }\n\n  if (cursor !== directoryEnd) {\n    throw new Error(\"Invalid zip archive: central directory size does not match its records.\");\n  }\n  if (recordCount !== declaredEntryCount || recordCount !== localHeaderCount) {\n    throw new Error(\n      `Invalid zip archive: central directory declares ${declaredEntryCount} entries but ${localHeaderCount} local entries were read (truncated or corrupt).`,\n    );\n  }\n}\n\nfunction sharedArchiveRoot(paths: string[]) {\n  if (paths.length === 0) return null;\n  const firstSegments = paths\n    .map((entry) => normalizeArchivePath(entry).split(\"/\").filter(Boolean))\n    .filter((parts) => parts.length > 0);\n  if (firstSegments.length === 0) return null;\n  const candidate = firstSegments[0]![0]!;\n  return firstSegments.every((parts) => parts.length > 1 && parts[0] === candidate)\n    ? candidate\n    : null;\n}\n\nexport function isBlobStorePath(pathValue: string) {","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/packages/shared/src/portability-zip.ts#L103-L139","documentation":"Error \"Invalid zip archive: central directory declares ${declaredEntryCount} entries but ${localHeaderCount} local entries were read (truncated or corrupt).\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at packages/shared/src/portability-zip.ts:121 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-download the complete archive; entry counts are inconsistent (truncated/corrupt)."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}