{"record":{"id":"36279ac047b16262","repo":"prestodb/presto","slug":"write-side-compression-verification-failed-s-un","errorCode":null,"errorMessage":"Write-side compression verification failed: %s (uncompressedSize=%s compressedSize=%s)","messagePattern":"Write-side compression verification failed: (.+?) \\(uncompressedSize=(.+?) compressedSize=(.+?)\\)","errorType":"exception","errorClass":"OrcCompressionVerificationException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/OrcOutputBuffer.java","lineNumber":631,"sourceCode":"            Decompressor verifyDecompressor,\n            CompressionBufferPool decompressionBufferPool,\n            byte[] original,\n            int offset,\n            int length,\n            byte[] compressed,\n            int compressedLength)\n    {\n        byte[] decompressed = decompressionBufferPool.checkOut(length);\n        try {\n            int decompressedLength;\n            try {\n                decompressedLength = verifyDecompressor.decompress(compressed, 0, compressedLength, decompressed, 0, length);\n            }\n            catch (RuntimeException e) {\n                // Any decode failure (ZstdException, MalformedInputException, ...) means the\n                // freshly compressed chunk is not decodable. Chain the cause so the original\n                // decoder stack trace is preserved.\n                throw new OrcCompressionVerificationException(\n                        e,\n                        \"Write-side compression verification failed: %s (uncompressedSize=%s compressedSize=%s)\",\n                        e.getMessage(),\n                        length,\n                        compressedLength);\n            }\n            if (decompressedLength != length || !Arrays.equals(decompressed, 0, length, original, offset, offset + length)) {\n                throw new OrcCompressionVerificationException(\n                        \"Write-side compression verification failed: chunk does not decode back to the original bytes (uncompressedSize=%s compressedSize=%s decompressedSize=%s)\",\n                        length,\n                        compressedLength,\n                        decompressedLength);\n            }\n        }\n        finally {\n            decompressionBufferPool.checkIn(decompressed);\n        }\n    }","sourceCodeStart":613,"sourceCodeEnd":649,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/OrcOutputBuffer.java#L613-L649","documentation":"verifyCompressedChunk decompresses each freshly written chunk and wraps any RuntimeException from the decompressor (ZstdException, MalformedInputException, etc.) into OrcCompressionVerificationException. This means data the writer just compressed could not be decoded back, so the written file would be corrupt.","triggerScenarios":"During writeChunkToOutputStream, the verify decompressor throws while decoding a just-compressed chunk (decoder failure on the compressed bytes).","commonSituations":"Faulty JNI/native codec libraries (e.g. broken Zstd JNI), buffer/offset bugs in custom decompressors, memory corruption, or incompatible codec implementations.","solutions":["Inspect the chained cause (getCause) to identify the failing codec","Verify the native/JNI codec library version and integrity (e.g. zstd-jni)","Disable write-side compression verification if it is not required for your workload","Downgrade/upgrade the codec library to a known-good version"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check codec availability before writing\ntry (OrcWriter w = OrcWriter.builder().setCompressionKind(kind).build()) { /* ... */ }","typeGuard":null,"tryCatchPattern":"try { orcWriter.write(page); }\ncatch (OrcCompressionVerificationException e) {\n    LOG.error(\"Codec round-trip failure\", e.getCause());\n    throw new IOException(\"Write aborted: corrupt chunk\", e);\n}","preventionTips":["Keep zstd-jni / aircompressor native libs up to date","Run write-verification in staging with production codecs","Avoid unverified custom Decompressor implementations"],"tags":["orc","compression","write-path","data-corruption"],"backgroundTag":"compression-verification-failed","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"}