{"record":{"id":"5ea91b4444fad56a","repo":"vercel-labs/skills","slug":"invalid-zip64-end-of-central-directory","errorCode":null,"errorMessage":"Invalid zip64 end of central directory","messagePattern":"Invalid zip64 end of central directory","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/archive.ts","lineNumber":114,"sourceCode":"    throw new Error('Multi-disk zip archives are not supported');\n  }\n\n  const locatorOffset = endOffset - 20;\n  ensureRange(buffer, locatorOffset, 20, 'zip64 locator');\n  if (buffer.readUInt32LE(locatorOffset) !== ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR) {\n    throw new Error('Invalid zip64 locator');\n  }\n  if (\n    buffer.readUInt32LE(locatorOffset + 4) !== 0 ||\n    buffer.readUInt32LE(locatorOffset + 16) !== 1\n  ) {\n    throw new Error('Multi-disk zip archives are not supported');\n  }\n\n  const zip64EndOffset = readUInt64AsNumber(buffer, locatorOffset + 8, 'zip64 end offset');\n  ensureRange(buffer, zip64EndOffset, 56, 'zip64 end of central directory');\n  if (buffer.readUInt32LE(zip64EndOffset) !== ZIP64_END_OF_CENTRAL_DIRECTORY) {\n    throw new Error('Invalid zip64 end of central directory');\n  }\n\n  const recordSize = readUInt64AsNumber(buffer, zip64EndOffset + 4, 'zip64 end size');\n  if (recordSize < 44) {\n    throw new Error('Invalid zip64 end of central directory');\n  }\n  ensureRange(buffer, zip64EndOffset, recordSize + 12, 'zip64 end of central directory');\n  if (zip64EndOffset + recordSize + 12 !== locatorOffset) {\n    throw new Error('Invalid zip64 end of central directory');\n  }\n  if (\n    buffer.readUInt32LE(zip64EndOffset + 16) !== 0 ||\n    buffer.readUInt32LE(zip64EndOffset + 20) !== 0\n  ) {\n    throw new Error('Multi-disk zip archives are not supported');\n  }\n\n  const zip64EntriesOnDisk = readUInt64AsNumber(","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/vercel-labs/skills/blob/435076e78988e1e6ec40d00b0b1d76bdbbc5419a/src/archive.ts#L96-L132","documentation":"After following the locator, the parser expects the zip64 end-of-central-directory record to begin with the ZIP64_END_OF_CENTRAL_DIRECTORY signature. A mismatch means the bytes at the recorded offset are not actually a zip64 end record — the file is corrupt, the offset is wrong, or the locator was a false positive.","triggerScenarios":"The locator's 64-bit offset field points to the wrong location (corruption or buggy writer); appending/prepending data shifted the record without updating offsets; fuzzed input where a fake locator precedes the EOCD.","commonSituations":"Archives modified after creation (data appended by mail systems, self-extractor stubs) that desync locator offsets; files corrupted in transit; archives produced by zip writers with known zip64 offset bugs.","solutions":["Test and repair with `unzip -t` / `zip -FF file.zip --out fixed.zip`, then parse the fixed file.","Re-download or regenerate the archive from the original source.","If you build archives programmatically, update the zip library to a version with correct zip64 offset writing."],"exampleFix":"# before\nreadZipArchive(buffer); // throws 'Invalid zip64 end of central directory'\n\n# after\nzip -FF broken.zip --out fixed.zip\nreadZipArchive(await fs.promises.readFile('fixed.zip'));","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n  const zip = readZipArchive(buffer);\n} catch (e) {\n  if ((e as Error).message === 'Invalid zip64 end of central directory') {\n    // run zip -FF repair or re-download\n  }\n  throw e;\n}","preventionTips":["Never modify zip bytes in place (appending stubs breaks trailer offsets).","Verify large-file transfers with checksums.","Keep zip tooling up to date on both producer and consumer sides."],"tags":["zip","zip64","corrupt-file","signature-mismatch","parsing"],"backgroundTag":"zip64-eocd-invalid","analyzedSha":"435076e78988e1e6ec40d00b0b1d76bdbbc5419a","analyzedAt":"2026-08-28T17:47:53.369Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}