{"record":{"id":"0c9150c9dc708c08","repo":"can1357/oh-my-pi","slug":"invalid-zip-archive-missing-zip64-extra-field","errorCode":null,"errorMessage":"Invalid ZIP archive: missing ZIP64 extra field","messagePattern":"Invalid ZIP archive: missing ZIP64 extra field","errorType":"exception","errorClass":"ArchiveError","httpStatus":null,"severity":"error","filePath":"packages/utils/src/ar/zip.ts","lineNumber":304,"sourceCode":"\t\t\tresult.mtimeMs = parseNtfsMtime(data);\n\t\t}\n\t\toffset = dataEnd;\n\t}\n\treturn result;\n}\n\nfunction applyZip64Values(\n\textra: Uint8Array | undefined,\n\tcurrent: Zip64Values,\n\tplaceholders: Zip64Placeholders,\n): Zip64Values {\n\tconst needs =\n\t\tplaceholders.uncompressedSize ||\n\t\tplaceholders.compressedSize ||\n\t\tplaceholders.localHeaderOffset ||\n\t\tplaceholders.diskStart;\n\tif (!needs) return current;\n\tif (!extra) throw new ArchiveError(\"Invalid ZIP archive: missing ZIP64 extra field\");\n\tlet offset = 0;\n\tconst result = { ...current };\n\tif (placeholders.uncompressedSize) {\n\t\tif (offset + 8 > extra.byteLength) throw new ArchiveError(\"Invalid ZIP archive: malformed ZIP64 extra field\");\n\t\tresult.uncompressedSize = readUInt64LE(extra, offset);\n\t\toffset += 8;\n\t}\n\tif (placeholders.compressedSize) {\n\t\tif (offset + 8 > extra.byteLength) throw new ArchiveError(\"Invalid ZIP archive: malformed ZIP64 extra field\");\n\t\tresult.compressedSize = readUInt64LE(extra, offset);\n\t\toffset += 8;\n\t}\n\tif (placeholders.localHeaderOffset) {\n\t\tif (offset + 8 > extra.byteLength) throw new ArchiveError(\"Invalid ZIP archive: malformed ZIP64 extra field\");\n\t\tresult.localHeaderOffset = readUInt64LE(extra, offset);\n\t\toffset += 8;\n\t}\n\tif (placeholders.diskStart) {","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/ar/zip.ts#L286-L322","documentation":"A ZIP entry uses ZIP64 placeholders (0xFFFFFFFF sizes/offset or 0xFFFF disk number), meaning the real values must come from a ZIP64 extra field (id 0x0001), but no such extra field exists in the entry's extra data. The archive is inconsistent: it declares ZIP64 encoding without supplying the actual 64-bit values, so the library cannot resolve the real sizes or offsets.","triggerScenarios":"Calling a ZIP read/list API on an entry whose central-directory record has placeholder values (uncompressedSize/compressedSize/localHeaderOffset == 0xFFFFFFFF or diskStart == 0xFFFF) while its extra field list contains no 0x0001 record.","commonSituations":"Archives produced by broken ZIP64 implementations, archives post-processed by tools that drop unrecognized extra fields, or truncated/malformed downloads of large (>4GB) archives.","solutions":["Re-obtain the archive and verify its integrity (unzip -t, 7z t).","Repack the archive with a conformant tool (7z, Info-ZIP zip, Python zipfile) so ZIP64 records are emitted correctly.","If your writer produces this, emit a ZIP64 extra field (id 0x0001) with 8-byte uncompressed size, 8-byte compressed size, 8-byte offset, 4-byte disk whenever placeholders are used."],"exampleFix":"// producer bug: setting placeholder but dropping extra field\n// after\n// extra = Buffer.concat([extra, zip64Extra({uncompressedSize, compressedSize, localHeaderOffset, diskStart})]);","handlingStrategy":"validation","validationCode":"import { $ } from \"bun\";\nconst probe = await $`unzip -v archive.zip`.quiet().nothrow();\nif (probe.exitCode !== 0) throw new Error(\"ZIP64 archive is malformed; refusing to parse\");","typeGuard":null,"tryCatchPattern":"try {\n  await archive.readMember(path);\n} catch (err) {\n  if (err instanceof ArchiveError && err.message.includes(\"missing ZIP64 extra field\")) {\n    throw new Error(`Archive ${zipPath} is corrupt (ZIP64 values absent); re-obtain it`);\n  } else throw err;\n}","preventionTips":["Keep an original copy of large archives; >4GB files are ZIP64 and more fragile to third-party rewriters.","Avoid tools that strip extra fields when post-processing ZIP64 archives.","Validate with 7z t before ingestion."],"tags":["zip","zip64","archive-corruption"],"backgroundTag":"zip64-missing-extra-field","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}