{"record":{"id":"d1b3622216696122","repo":"vercel-labs/skills","slug":"multi-disk-zip-archives-are-not-supported","errorCode":null,"errorMessage":"Multi-disk zip archives are not supported","messagePattern":"Multi-disk zip archives are not supported","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/archive.ts","lineNumber":90,"sourceCode":"  offset: number;\n  size: number;\n  trailerOffset: number;\n} {\n  const diskNumber = buffer.readUInt16LE(endOffset + 4);\n  const centralDirectoryDisk = buffer.readUInt16LE(endOffset + 6);\n  const entriesOnDisk = buffer.readUInt16LE(endOffset + 8);\n  const totalEntries = buffer.readUInt16LE(endOffset + 10);\n  const size = buffer.readUInt32LE(endOffset + 12);\n  const offset = buffer.readUInt32LE(endOffset + 16);\n  const usesZip64 =\n    entriesOnDisk === 0xffff ||\n    totalEntries === 0xffff ||\n    size === 0xffffffff ||\n    offset === 0xffffffff;\n\n  if (!usesZip64) {\n    if (diskNumber !== 0 || centralDirectoryDisk !== 0 || entriesOnDisk !== totalEntries) {\n      throw new Error('Multi-disk zip archives are not supported');\n    }\n    return { entries: totalEntries, offset, size, trailerOffset: endOffset };\n  }\n\n  if (diskNumber !== 0 || centralDirectoryDisk !== 0) {\n    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');","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/vercel-labs/skills/blob/435076e78988e1e6ec40d00b0b1d76bdbbc5419a/src/archive.ts#L72-L108","documentation":"The zip end-of-central-directory record contains disk-number fields. This library only supports single-disk archives, so if the 'disk number' or 'central directory disk' fields are non-zero, or the per-disk entry count differs from the total entry count, it throws this error. Multi-disk (spanned/split) zips are rare and produced only by old or specialized tools.","triggerScenarios":"Parsing a spanned/split zip archive (e.g. created with `zip -s` or PKZIP split mode) where diskNumber or centralDirectoryDisk is > 0; a corrupt record where these bytes happen to be non-zero; an archive concatenated in a way that misaligns the end record so garbage is read as disk fields.","commonSituations":"Users receiving multi-part archives (.z01, .z02, ... .zip) and passing only the final .zip segment to the parser; legacy PKZIP split output; byte-corruption during transfer flipping the disk number field.","solutions":["Reassemble split archives into a single file first: `zip -s 0 archive.zip --out full.zip` (or `zip -FF` to fix), then parse the merged file.","Re-download or re-create the archive; a single-disk tool (standard `zip`, `Compress-Archive`, etc.) never sets these fields.","If you only have the final segment, extract with a tool that supports spanning instead of this library, then repackage as a single-disk zip."],"exampleFix":"# before (passing only the last part of a split set)\nunzip -t archive.zip   # multi-disk errors\n\n# after: merge parts into one archive first\nzip -s 0 archive.zip --out archive-full.zip\n# then parse archive-full.zip","handlingStrategy":"validation","validationCode":"function isSingleDisk(buffer: Buffer, eocd: number): boolean {\n  return buffer.readUInt16LE(eocd + 4) === 0 && buffer.readUInt16LE(eocd + 6) === 0;\n}","typeGuard":"null","tryCatchPattern":"try {\n  const zip = readZipArchive(buffer);\n} catch (e) {\n  if ((e as Error).message === 'Multi-disk zip archives are not supported') {\n    // ask sender for a merged/single-disk archive\n  }\n  throw e;\n}","preventionTips":["Reject multi-part (.z01/.z02) uploads at the interface; require single-file zips.","Document that split/spanned archives are unsupported.","If accepting user uploads, merge parts server-side with `zip -s 0` before parsing."],"tags":["zip","multi-disk","spanned-archive","split-archive","unsupported-feature"],"backgroundTag":"zip-multi-disk-unsupported","analyzedSha":"435076e78988e1e6ec40d00b0b1d76bdbbc5419a","analyzedAt":"2026-08-28T17:47:53.369Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}