{"record":{"id":"9831a8c8616c5184","repo":"apache/iceberg","slug":"could-not-read-page-s-in-col-s","errorCode":null,"errorMessage":"could not read page %s in col %s","messagePattern":"could not read page (.+?) in col (.+?)","errorType":"exception","errorClass":"ParquetDecodingException","httpStatus":null,"severity":"error","filePath":"parquet/src/main/java/org/apache/iceberg/parquet/BasePageIterator.java","lineNumber":141,"sourceCode":"        });\n    this.triplesRead = 0;\n    this.hasNext = triplesRead < triplesCount;\n  }\n\n  protected void initFromPage(DataPageV1 initPage) {\n    this.triplesCount = initPage.getValueCount();\n    try {\n      BytesInput bytes = initPage.getBytes();\n      LOG.debug(\"page size {} bytes and {} records\", bytes.size(), triplesCount);\n      LOG.debug(\"reading repetition levels at 0\");\n      ByteBufferInputStream in = bytes.toInputStream();\n      initRepetitionLevelsReader(initPage, desc, in, triplesCount);\n      LOG.debug(\"reading definition levels at {}\", in.position());\n      initDefinitionLevelsReader(initPage, desc, in, triplesCount);\n      LOG.debug(\"reading data at {}\", in.position());\n      initDataReader(initPage.getValueEncoding(), in, initPage.getValueCount());\n    } catch (IOException e) {\n      throw new ParquetDecodingException(\"could not read page \" + initPage + \" in col \" + desc, e);\n    }\n  }\n\n  protected void initFromPage(DataPageV2 initPage) {\n    this.triplesCount = initPage.getValueCount();\n    try {\n      initRepetitionLevelsReader(initPage, desc);\n      initDefinitionLevelsReader(initPage, desc);\n      LOG.debug(\"page data size {} bytes and {} records\", initPage.getData().size(), triplesCount);\n      initDataReader(initPage.getDataEncoding(), initPage.getData().toInputStream(), triplesCount);\n    } catch (IOException e) {\n      throw new ParquetDecodingException(\"could not read page \" + initPage + \" in col \" + desc, e);\n    }\n  }\n\n  public void setDictionary(Dictionary dict) {\n    this.dictionary = dict;\n  }","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/parquet/src/main/java/org/apache/iceberg/parquet/BasePageIterator.java#L123-L159","documentation":"BasePageIterator.initFromPage(DataPageV1) initializes repetition/definition level readers and the data reader for a Parquet page. Any IOException during page decoding is rethrown as ParquetDecodingException identifying the page and column. It indicates a corrupt, truncated, or unreadable page.","triggerScenarios":"Called from the column reader's visit() when advancing to the next page: page bytes cannot be read from the input stream — truncated file, bad page header values, decompression errors, or storage I/O failure.","commonSituations":"Corrupted Parquet files from failed/interrupted writes; S3/HDFS read errors mid-scan; files damaged by external compaction or network tooling; version incompatibilities causing misparse of pages.","solutions":["Validate the file with a Parquet metadata tool to locate the corrupt column chunk/page.","Restore the file from the source, or rewrite the affected files (Iceberg rewrite_data_files / compaction) from a good copy.","If the cause is storage-level (network/permissions), fix the storage issue and retry the query.","Check writer versions: files written by known-buggy writers may need re-encoding with a fixed writer."],"exampleFix":"// before: query fails mid-scan with ParquetDecodingException\n// after: rewrite corrupted files\nspark.sql(\"CALL catalog.system.rewrite_data_files(table => 'db.tbl', options => map('rewrite-all','true'))\");","handlingStrategy":"try-catch","validationCode":"// Cheap pre-flight: read footer/metadata to detect truncation\ntry (ParquetFileReader pfr = ParquetFileReader.open(file.io().newInput(file.location()))) {\n  Preconditions.checkNotNull(pfr.getFooter());\n}","typeGuard":null,"tryCatchPattern":"try {\n  reader.read();\n} catch (ParquetDecodingException e) {\n  LOG.error(\"Corrupt page in column {}: {}\", e.getMessage(), e.getCause());\n  // quarantine/rewrite the file, do not silently skip rows\n}","preventionTips":["Verify checksums/complete transfers for parquet files","Avoid reading files while rewrite/compaction is in progress","Set storage read retries for transient IO errors","Rewrite files produced by known-buggy writer versions"],"tags":["parquet","corrupt-file","decoding"],"backgroundTag":"file-read-failed","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"}