{"record":{"id":"8dc8e768911ea07d","repo":"apache/iceberg","slug":"failed-to-create-parquet-reader","errorCode":null,"errorMessage":"Failed to create Parquet reader","messagePattern":"Failed to create Parquet reader","errorType":"exception","errorClass":"RuntimeIOException","httpStatus":null,"severity":"error","filePath":"parquet/src/main/java/org/apache/iceberg/parquet/ParquetIterable.java","lineNumber":43,"sourceCode":"import org.apache.iceberg.io.CloseableIterable;\nimport org.apache.iceberg.io.CloseableIterator;\nimport org.apache.parquet.hadoop.ParquetReader;\n\npublic class ParquetIterable<T> extends CloseableGroup implements CloseableIterable<T> {\n  private final ParquetReader.Builder<T> builder;\n\n  ParquetIterable(ParquetReader.Builder<T> builder) {\n    this.builder = builder;\n  }\n\n  @Override\n  public CloseableIterator<T> iterator() {\n    try {\n      ParquetReader<T> reader = builder.build();\n      addCloseable(reader);\n      return new ParquetIterator<>(reader);\n    } catch (IOException e) {\n      throw new RuntimeIOException(e, \"Failed to create Parquet reader\");\n    }\n  }\n\n  private static class ParquetIterator<T> implements CloseableIterator<T> {\n    private final ParquetReader<T> parquet;\n    private boolean needsAdvance = false;\n    private boolean hasNext = false;\n    private T next;\n\n    ParquetIterator(ParquetReader<T> parquet) {\n      this.parquet = parquet;\n      this.next = advance();\n    }\n\n    @Override\n    public boolean hasNext() {\n      if (needsAdvance) {\n        this.next = advance();","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/parquet/src/main/java/org/apache/iceberg/parquet/ParquetIterable.java#L25-L61","documentation":"ParquetIterable lazily opens an underlying ParquetReader when iterator() is first called. If building that reader (opening the file, reading metadata) throws an IOException, it is wrapped as a RuntimeIOException with this message. The error means the Parquet file could not be opened for reading.","triggerScenarios":"Calling iterator() on a ParquetIterable whose builder points at a missing, corrupt, or unreadable file; underlying ParquetReader.Builder.build() throws IOException (file open failure, footer read failure, truncated/corrupt file).","commonSituations":"Input file deleted or path mistyped; file truncated by a failed write; wrong Hadoop configuration so InputFile cannot be opened; permission errors on HDFS/S3; schema mismatch detected during reader construction.","solutions":["Verify the input file path/location exists and is readable before creating the iterable.","Inspect the wrapped IOException cause for the specific open/read failure.","Confirm credentials and filesystem configuration for the storage layer.","If the file is corrupt, rewrite it from source data or recover via a previous snapshot."],"exampleFix":"// before\nCloseableIterator<T> it = ParquetIterable.create(builder).iterator(); // throws at open\n// after\nif (fileSystem.exists(new Path(location))) {\n  CloseableIterator<T> it = ParquetIterable.create(builder).iterator();\n}","handlingStrategy":"validation","validationCode":"if (!fileSystem.exists(new Path(location))) {\n  throw new FileNotFoundException(location);\n}","typeGuard":null,"tryCatchPattern":"try {\n  return iterable.iterator();\n} catch (RuntimeIOException e) {\n  throw new IOException(\"Cannot open parquet file\", e.getCause());\n}","preventionTips":["Check file existence/readability before constructing the iterable.","Only read data files from committed table snapshots.","Verify storage credentials and Hadoop configs on the reading cluster."],"tags":["parquet","io","file-read"],"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-14T21:17:11.552Z"}