{"record":{"id":"96c411c4e4f5de23","repo":"prestodb/presto","slug":"could-not-decompress-all-input-output-buffer-too","errorCode":null,"errorMessage":"Could not decompress all input (output buffer too small?)","messagePattern":"Could not decompress all input \\(output buffer too small\\?\\)","errorType":"exception","errorClass":"OrcCorruptionException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/OrcZlibDecompressor.java","lineNumber":58,"sourceCode":"        try {\n            inflater.setInput(input, offset, length);\n            byte[] buffer = output.initialize(Math.min(length * EXPECTED_COMPRESSION_RATIO, maxBufferSize));\n\n            int uncompressedLength = 0;\n            while (true) {\n                uncompressedLength += inflater.inflate(buffer, uncompressedLength, buffer.length - uncompressedLength);\n                if (inflater.finished() || buffer.length >= maxBufferSize) {\n                    break;\n                }\n                int oldBufferSize = buffer.length;\n                buffer = output.grow(Math.min(buffer.length * 2, maxBufferSize));\n                if (buffer.length <= oldBufferSize) {\n                    throw new IllegalStateException(String.format(\"Buffer failed to grow. Old size %d, current size %d\", oldBufferSize, buffer.length));\n                }\n            }\n\n            if (!inflater.finished()) {\n                throw new OrcCorruptionException(orcDataSourceId, \"Could not decompress all input (output buffer too small?)\");\n            }\n\n            return uncompressedLength;\n        }\n        catch (DataFormatException e) {\n            throw new OrcCorruptionException(e, orcDataSourceId, \"Invalid compressed stream\");\n        }\n        finally {\n            inflater.end();\n        }\n    }\n\n    @Override\n    public String toString()\n    {\n        return \"zlib\";\n    }\n}","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/OrcZlibDecompressor.java#L40-L76","documentation":"Zlib decompression error in OrcZlibDecompressor.decompress: the inflater needs more output space than the configured max stream buffer size — the decompressed stripe/stream does not fit, so 'Could not decompress all input' fires. Usually a corrupt/truncated ORC stream or an implausibly high compression ratio.","triggerScenarios":"Thrown at presto-orc/src/main/java/com/facebook/presto/orc/OrcZlibDecompressor.java:58 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the ORC file is not truncated or corrupted","Increase the ORC stream max buffer size config if the file legitimately decompresses larger","Reproduce with another ORC reader to confirm file integrity"],"exampleFix":null,"handlingStrategy":"try-catch","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"}