{"record":{"id":"b21f7f9950568088","repo":"apache/iceberg","slug":"unrecognized-mode-mode","errorCode":null,"errorMessage":"Unrecognized mode: \" + mode","messagePattern":"Unrecognized mode: \" \\+ mode","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"arrow/src/main/java/org/apache/iceberg/arrow/vectorized/parquet/BaseVectorizedParquetValuesReader.java","lineNumber":241,"sourceCode":"  @Override\n  public int readValueDictionaryId() {\n    return readInteger();\n  }\n\n  @Override\n  public int readInteger() {\n    if (this.currentCount == 0) {\n      this.readNextGroup();\n    }\n\n    this.currentCount--;\n    switch (mode) {\n      case RLE:\n        return this.currentValue;\n      case PACKED:\n        return this.packedValuesBuffer[packedValuesBufferIdx++];\n    }\n    throw new RuntimeException(\"Unrecognized mode: \" + mode);\n  }\n}\n","sourceCodeStart":223,"sourceCodeEnd":244,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/arrow/src/main/java/org/apache/iceberg/arrow/vectorized/parquet/BaseVectorizedParquetValuesReader.java#L223-L244","documentation":"After decoding, readInteger dispatches on the current mode which must be RLE or PACKED; any other internal mode value is an invariant violation and throws RuntimeException. This means the decoder state machine is corrupted or misused.","triggerScenarios":"readInteger (also reached via readBoolean and readValueDictionaryId) when internal mode is neither RLE nor PACKED after readNextGroup.","commonSituations":"Reading values before the first readNextGroup call, or subclass misuse leaving the mode in an undefined state; rarely a corrupt page.","solutions":["Do not call readInteger/readBoolean out of order — drive the reader through its normal batch read API.","Check for custom subclasses that break the mode state machine.","If reproducible on standard reads, report it as a bug and fall back to non-vectorized reads."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// catch (RuntimeException e) {\n//   if (e.getMessage() != null && e.getMessage().startsWith(\"Unrecognized mode\")) {\n//     reportBugAndFallbackToNonVectorized();\n//   } else throw e;\n// }","preventionTips":["Drive the reader only through its documented batch API.","Avoid custom subclasses that mutate mode state.","Report reproducible cases upstream — this is an internal invariant."],"tags":["parquet","vectorized-reader","internal-state"],"backgroundTag":"internal-invariant-violation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}