prestodb/presto · error · ParquetDecodingException

not a valid mode

Error message

not a valid mode 

What it means

BooleanRLEValuesDecoder.readNext decodes RLE/bit-packed runs of boolean values; only Mode.RLE and Mode.PACKED_BIT_PACKED are supported. An unknown mode in a run header aborts decoding with a ParquetDecodingException naming the invalid mode. The boolean column's index stream is then unusable.

Source

Thrown at presto-parquet/src/main/java/com/facebook/presto/parquet/batchreader/decoders/rle/BooleanRLEValuesDecoder.java:122

                        remainingPackedBlock -= 8;
                        destinationIndex += 8;
                    }

                    if (remainingPackedBlock > 0) {
                        // read partial values from current byte until the requested length is satisfied
                        byte inValue = localInputBuffer.get();
                        for (int i = 0; i < remainingPackedBlock; i++) {
                            values[destinationIndex++] = (byte) (inValue >> i & 1);
                        }

                        currentByte = inValue;
                        currentByteOffset = remainingPackedBlock;
                    }

                    break;
                }
                default:
                    throw new ParquetDecodingException("not a valid mode " + mode);
            }
            currentCount -= numEntriesToFill;
            remainingToCopy -= numEntriesToFill;
        }
    }

    @Override
    public void skip(int length)
    {
        int remainingToSkip = length;
        while (remainingToSkip > 0) {
            if (currentCount == 0) {
                readNext();
                if (currentCount == 0) {
                    break;
                }
            }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Run parquet-tools/parquet-cli dump on the boolean column to confirm corruption
  2. Re-transfer the file and verify checksums
  3. Rewrite the file with a standard Parquet writer
  4. File a bug against presto-parquet if other engines read the same file fine

Example fix

// before: query fails on boolean column with mode=<garbage>
// after: SELECT rewrite with standard writer
//   INSERT INTO target SELECT bool_col, ... FROM corrupted_external
//   (writer re-encodes with valid RLE headers)
Defensive patterns

Strategy: try-catch

Validate before calling

// parquet-tools dump --column '<bool col>' file.parquet  # confirm valid RLE runs before query

Try / catch

try {
    decoder.readNext(count);
} catch (ParquetDecodingException e) {
    if (e.getMessage().startsWith("not a valid mode")) {
        // mark file as corrupt and switch to a repaired replica
    }
    throw e;
}

Prevention

When it happens

Trigger: readNext() on a boolean column encounters a run header whose mode bits are neither RLE nor PACKED_BIT_PACKED.

Common situations: Corrupted boolean column chunks (partial writes, transfer truncation); exotic writers using invalid hybrid headers; reading with wrong offsets after prior stream corruption.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/986054ced504743f. Report an issue: GitHub.