apache/iceberg · error · RuntimeIOException
Failed to get ORC rows for file: %s
Error message
Failed to get ORC rows for file: %s
What it means
OrcIterable.newOrcIterator builds a VectorizedRowBatchIterator over the ORC file's rows using the configured reader options (predicate sarg, projection schema, batch size). If creating that iterator triggers an IOException from the ORC reader, it is wrapped in RuntimeIOException with the file location. This happens lazily when the scan actually opens the file.
Source
Thrown at orc/src/main/java/org/apache/iceberg/orc/OrcIterable.java:141
InputFile file,
TypeDescription readerSchema,
Long start,
Long length,
Reader orcFileReader,
SearchArgument sarg,
int recordsPerBatch) {
final Reader.Options options = orcFileReader.options();
if (start != null) {
options.range(start, length);
}
options.schema(readerSchema);
options.searchArgument(sarg, new String[] {});
try {
return new VectorizedRowBatchIterator(
file.location(), readerSchema, orcFileReader.rows(options), recordsPerBatch);
} catch (IOException ioe) {
throw new RuntimeIOException(ioe, "Failed to get ORC rows for file: %s", file.location());
}
}
private static class OrcRowIterator<T> implements CloseableIterator<T> {
private int nextRow;
private VectorizedRowBatch current;
private int currentBatchSize;
private final VectorizedRowBatchIterator batchIter;
private final OrcRowReader<T> reader;
OrcRowIterator(VectorizedRowBatchIterator batchIter, OrcRowReader<T> reader) {
this.batchIter = batchIter;
this.reader = reader;
current = null;
nextRow = 0;
currentBatchSize = 0;View on GitHub (pinned to 86d9c8fc54)
Solutions
- Check the wrapped cause: verify the file exists, is a valid ORC file, and is readable with current credentials/permissions.
- Validate file integrity (footers readable) — rewrite corrupt files from a source of truth if the footer/stripes are damaged.
- Add retry for transient storage errors, and re-plan the scan if files were deleted/expired between planning and reading.
Example fix
// before
CloseableIterable<Record> rows = ORC.read(io).project(schema).build();
rows.forEach(...); // RuntimeIOException: Failed to get ORC rows
// after: pre-validate and handle
try (CloseableIterable<Record> rows = ORC.read(io).project(schema).build()) {
rows.forEach(...);
} catch (RuntimeIOException e) {
LOG.error("ORC read failed: {} cause: {}", e.getMessage(), e.getCause());
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
if (!inputFile.exists()) {
throw new IllegalStateException("ORC input file missing: " + inputFile.location());
} Try / catch
try (CloseableIterable<T> it = ORC.read(io).project(schema).build()) {
it.forEach(...);
} catch (RuntimeIOException e) {
LOG.error("ORC read failed: {} cause: {}", e.getMessage(), e.getCause());
if (isTransient(e.getCause())) retry();
throw e;
} Prevention
- Re-plan scans if files may expire/be deleted between planning and reading
- Validate ORC footer readability before large batch reads
- Configure retries for transient S3/HDFS errors
When it happens
Trigger: Iterating an ORC file via ORC.read(...).build() when orcFileReader.rows(options) throws IOException: the file is missing/corrupt/truncated, or credentials/storage access fail while opening rows with the search argument and reader schema.
Common situations: Deleted or expiring S3 objects between planning and read; corrupt/truncated ORC files after failed writes; permission or credential problems on HDFS/S3 at read time.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Unable to read the metrics of the Orc file:
- Problem writing to ORC file %s
- Can't get Stripe's length from the file writer with path: %s
- Failed to get stripe information from writer for: %s
- Failed to get statistics from writer
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/cb585de800114239.
Report an issue: GitHub.