apache/iceberg · error · ParquetDecodingException

not a valid mode " + this.mode

Error message

not a valid mode " + this.mode

What it means

readNextGroup decodes RLE/bit-packed hybrid pages; an unknown mode value in the page header is not RLE or BIT_PACKED, so it throws ParquetDecodingException. This signals the page data cannot be decoded by this reader.

Source

Thrown at arrow/src/main/java/org/apache/iceberg/arrow/vectorized/parquet/BaseVectorizedParquetValuesReader.java:206

          return;
        case PACKED:
          int numGroups = header >>> 1;
          this.currentCount = numGroups * 8;
          if (this.packedValuesBuffer.length < this.currentCount) {
            this.packedValuesBuffer = new int[this.currentCount];
          }
          packedValuesBufferIdx = 0;
          int valueIndex = 0;
          while (valueIndex < this.currentCount) {
            // values are bit packed 8 at a time, so reading bitWidth will always work
            ByteBuffer buffer = inputStream.slice(bitWidth);
            this.packer.unpack8Values(
                buffer, buffer.position(), this.packedValuesBuffer, valueIndex);
            valueIndex += 8;
          }
          return;
        default:
          throw new ParquetDecodingException("not a valid mode " + this.mode);
      }
    } catch (IOException e) {
      throw new ParquetDecodingException("Failed to read from input stream", e);
    }
  }

  @Override
  public boolean readBoolean() {
    return this.readInteger() != 0;
  }

  @Override
  public void skip() {
    throw new UnsupportedOperationException();
  }

  @Override
  public int readValueDictionaryId() {

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Disable vectorized reads so the full-featured Parquet decoder handles the page.
  2. Validate the file with parquet-tools; if corrupt, regenerate the file.
  3. Rewrite the data with a current Iceberg/Parquet writer version.
Defensive patterns

Strategy: try-catch

Try / catch

// catch (ParquetDecodingException e) {
//   if (e.getMessage().contains("not a valid mode")) {
//     fallbackToNonVectorizedScan();
//   } else throw e;
// }

Prevention

When it happens

Trigger: A page header whose encoding mode is neither RLE nor PACKED during readNextGroup, reached from readInteger.

Common situations: Corrupted Parquet files, files written with encodings unsupported by the vectorized path, or truncated page data mid-scan.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/de4f121d6c674f1d. Report an issue: GitHub.