{"record":{"id":"3d5264e2e91dfeb6","repo":"prestodb/presto","slug":"druid-segment-load-error-3d5264","errorCode":"DRUID_SEGMENT_LOAD_ERROR","errorMessage":"Malformed End of Central Directory Record; does not start with %08x","messagePattern":"Malformed End of Central Directory Record; does not start with %08x","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"critical","filePath":"presto-druid/src/main/java/com/facebook/presto/druid/zip/Zip64EndOfCentralDirectory.java","lineNumber":48,"sourceCode":"    static final int CD_OFFSET_OFFSET = 48;\n\n    private Zip64EndOfCentralDirectory()\n    {\n    }\n\n    /**\n     * Read the Zip64 end of central directory record from the input stream and parse additional\n     * {@link ZipFileData} from it.\n     */\n    public static void read(ZipFileData file, DataInputSource dataInputSource, long offset)\n            throws IOException\n    {\n        checkArgument(file != null, \"Zip file data for source:%s is null\", dataInputSource.getId());\n\n        byte[] fixedSizeData = new byte[FIXED_DATA_SIZE];\n        dataInputSource.readFully(offset, fixedSizeData);\n        if (!ZipUtil.arrayStartsWith(fixedSizeData, ZipUtil.intToLittleEndian(SIGNATURE))) {\n            throw new PrestoException(DRUID_SEGMENT_LOAD_ERROR, format(\"Malformed End of Central Directory Record; does not start with %08x\", SIGNATURE));\n        }\n        file.setZip64(true);\n        file.setCentralDirectoryOffset(ZipUtil.getUnsignedLong(fixedSizeData, CD_OFFSET_OFFSET));\n        file.setExpectedEntries(ZipUtil.getUnsignedLong(fixedSizeData, TOTAL_ENTRIES_OFFSET));\n    }\n}\n","sourceCodeStart":30,"sourceCodeEnd":55,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-druid/src/main/java/com/facebook/presto/druid/zip/Zip64EndOfCentralDirectory.java#L30-L55","documentation":"Zip64EndOfCentralDirectory.read validates the ZIP64 EOCD locator target starts with the ZIP64 EOCD signature 0x06064b50. When the bytes at the given offset are not that signature, the ZIP64 end-of-central-directory structure is missing or corrupt and DRUID_SEGMENT_LOAD_ERROR is thrown.","triggerScenarios":"read() on a file whose Zip64 EOCD record offset (from the locator or EOCD fields) points at data that does not start with the ZIP64 signature — typically a very large archive (>4GB / >65535 entries) whose ZIP64 structures were truncated or written incorrectly.","commonSituations":"Huge Druid segment zips created or transferred by tools that drop/rewrite ZIP64 extensions, truncated multi-gigabyte uploads, or archives created with streaming writers that emit incorrect ZIP64 offsets.","solutions":["Re-create the segment zip with a ZIP64-capable standard tool (zip -64 / java.util.zip with ZIP64) and re-upload.","Verify the large archive's integrity end-to-end (checksum before/after upload).","Reduce archive size or entry count below ZIP64 thresholds if the producing pipeline mishandles ZIP64.","Confirm the deep-storage object wasn't truncated by a proxy with a size limit."],"exampleFix":"// before: streaming write that may omit ZIP64\nzipOut.putNextEntry(hugeEntry);\n// after: ensure ZIP64 mode / precomputed sizes\nzipOut.setUseZip64(Zip64Mode.Always);\nentry.setSize(precomputedSize);\nzipOut.putNextEntry(hugeEntry);","handlingStrategy":"validation","validationCode":"if (entryCount > 0xFFFF || totalSize > 0xFFFFFFFFL) {\n    verifyZip64StructuresPresent(archiveBytes); // locator + ZIP64 EOCD signature 0x06064b50\n}","typeGuard":null,"tryCatchPattern":"try {\n    zip64Eocd = Zip64EndOfCentralDirectory.read(source, offset);\n} catch (PrestoException e) {\n    log.error(\"Missing/corrupt ZIP64 EOCD for %s\", source.getId(), e);\n    rebuildAndReuploadSegment(segmentId);\n}","preventionTips":["Always build large archives with ZIP64 enabled end-to-end.","Verify multi-GB uploads with checksums; watch for proxy size limits.","Test producing pipelines with >4GB archives before production use."],"tags":["zip","zip64","druid","large-archive"],"backgroundTag":"malformed-zip-missing-eocd","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}