{"record":{"id":"c3f2d6bd23c6f850","repo":"prestodb/presto","slug":"not-a-valid-mode-c3f2d6","errorCode":null,"errorMessage":"not a valid mode ","messagePattern":"not a valid mode ","errorType":"exception","errorClass":"ParquetDecodingException","httpStatus":null,"severity":"error","filePath":"presto-parquet/src/main/java/com/facebook/presto/parquet/batchreader/decoders/RepetitionLevelDecoder.java","lineNumber":93,"sourceCode":"                    break;\n                }\n                case PACKED: {\n                    final int[] localBuffer = currentBuffer;\n                    do {\n                        int rlValue = localBuffer[currentOffsetPackedBuffer];\n                        currentOffsetPackedBuffer = currentOffsetPackedBuffer + 1;\n                        repetitionLevels.add(rlValue);\n                        if (rlValue == 0) {\n                            remainingToCopy--;\n                        }\n                        remaining--;\n                    }\n                    while (currentOffsetPackedBuffer < endOffsetPackedBuffer && remainingToCopy > 0);\n                    currentCount = endOffsetPackedBuffer - currentOffsetPackedBuffer;\n                    break;\n                }\n                default:\n                    throw new ParquetDecodingException(\"not a valid mode \" + mode);\n            }\n        }\n        return batchSize - remainingToCopy;\n    }\n\n    @Override\n    public long getRetainedSizeInBytes()\n    {\n        return INSTANCE_SIZE + sizeOf(currentBuffer);\n    }\n\n    private boolean ensureBlockAvailable()\n            throws IOException\n    {\n        if (currentCount == 0) {\n            if (!decode()) {\n                return false;\n            }","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-parquet/src/main/java/com/facebook/presto/parquet/batchreader/decoders/RepetitionLevelDecoder.java#L75-L111","documentation":"RepetitionLevelDecoder.readNext decodes repetition levels using either RLE or bit-packed mode, selected by the chunk header. A mode value outside the known enum means the repetition-level stream cannot be decoded and a ParquetDecodingException is thrown. This indicates malformed or unsupported repetition-level data in the column chunk.","triggerScenarios":"readNext() hits the default branch of its mode switch because the repetition-level chunk header encodes an unknown mode value (not RLE, not PACKED_BIT_PACKED).","commonSituations":"Corrupted or truncated nested-column (list/map/struct) Parquet files; files written by non-standard writers using unsupported repetition-level encodings; version mismatch between the writer and the Presto parquet reader.","solutions":["Validate the file with parquet-tools and check the repetition-level encoding on the affected column","Re-write the file with a mainstream writer using standard RLE repetition levels","Upgrade the Presto parquet reader to a version that handles the writer's encoding","Confirm the file was not truncated in transfer (compare checksums) before filing a bug"],"exampleFix":"// before: reading a file whose nested column uses an unknown repetition-level mode\n// after: rewrite the nested data with standard encodings\n//   df.repartition(1).write.format(\"parquet\").save(\"/fixed/path\")","handlingStrategy":"validation","validationCode":"// parquet-tools meta file.parquet | grep <nested column>  # expect: RLE for repetition/definition levels","typeGuard":null,"tryCatchPattern":"try {\n    pageReader.readNextPage();\n} catch (ParquetDecodingException e) {\n    if (e.getMessage().contains(\"not a valid mode\")) {\n        log.error(\"Corrupt repetition-level stream in \" + column); \n    }\n    throw e;\n}","preventionTips":["Check nested (list/map/struct) columns with parquet-tools before loading","Reject files from unknown writers at ingest time","Compare file checksums after any network transfer","Keep the Presto parquet reader updated for new writer encodings"],"tags":["parquet","decoding","nested-types"],"backgroundTag":"parquet-invalid-encoding-mode","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"}