{"record":{"id":"7bd3234401361954","repo":"prestodb/presto","slug":"invalid-uncompressedsize-for-gzip-input-expected","errorCode":null,"errorMessage":"Invalid uncompressedSize for GZIP input. Expected %s, actual: %s","messagePattern":"Invalid uncompressedSize for GZIP input\\. Expected (.+?), actual: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-parquet/src/main/java/com/facebook/presto/parquet/ParquetCompressionUtils.java","lineNumber":107,"sourceCode":"        }\n\n        byte[] buffer = new byte[uncompressedSize];\n        int bytesRead = 0;\n        boolean eos = false;\n        try (GZIPInputStream gzipInputStream = new GZIPInputStream(input.getInput(), min(GZIP_BUFFER_SIZE, input.length()))) {\n            int n;\n            do {\n                n = gzipInputStream.read(buffer, bytesRead, buffer.length - bytesRead);\n                if (n < 0) {\n                    eos = true;\n                    break;\n                }\n                bytesRead += n;\n            } while (bytesRead < buffer.length);\n            checkArgument(eos || gzipInputStream.read() == -1, \"Invalid uncompressedSize for GZIP input. Actual size exceeds %s bytes\", uncompressedSize);\n        }\n        if (bytesRead != uncompressedSize) {\n            throw new IllegalArgumentException(format(\"Invalid uncompressedSize for GZIP input. Expected %s, actual: %s\", uncompressedSize, bytesRead));\n        }\n        return wrappedBuffer(buffer, 0, bytesRead);\n    }\n\n    private static Slice decompressLz4(Slice input, int uncompressedSize)\n    {\n        return decompressFramed(new Lz4Decompressor(), input, uncompressedSize);\n    }\n\n    private static Slice decompressLZO(Slice input, int uncompressedSize)\n    {\n        return decompressFramed(new LzoDecompressor(), input, uncompressedSize);\n    }\n\n    private static Slice decompressFramed(Decompressor decompressor, Slice input, int uncompressedSize)\n    {\n        long totalDecompressedCount = 0;\n        // over allocate buffer which makes decompression easier","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-parquet/src/main/java/com/facebook/presto/parquet/ParquetCompressionUtils.java#L89-L125","documentation":"Post-decompression consistency check in decompressGzip: the Parquet page header declares an uncompressedSize, but the GZIP stream decompressed to a different byte count (either the decompressed data ended early/overflowed). This means the page header or the compressed payload is corrupt, or the file was written by a nonconforming writer.","triggerScenarios":"Thrown at presto-parquet/src/main/java/com/facebook/presto/parquet/ParquetCompressionUtils.java:107 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Regenerate the Parquet file with a conforming writer (verify sizes match)","Verify file transfer/storage integrity — checksum the object","Check for mixed gzip members or truncated streams; if intended, split pages so sizes agree"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}