{"record":{"id":"cb585de800114239","repo":"apache/iceberg","slug":"failed-to-get-orc-rows-for-file-s","errorCode":null,"errorMessage":"Failed to get ORC rows for file: %s","messagePattern":"Failed to get ORC rows for file: (.+?)","errorType":"exception","errorClass":"RuntimeIOException","httpStatus":null,"severity":"error","filePath":"orc/src/main/java/org/apache/iceberg/orc/OrcIterable.java","lineNumber":141,"sourceCode":"      InputFile file,\n      TypeDescription readerSchema,\n      Long start,\n      Long length,\n      Reader orcFileReader,\n      SearchArgument sarg,\n      int recordsPerBatch) {\n    final Reader.Options options = orcFileReader.options();\n    if (start != null) {\n      options.range(start, length);\n    }\n    options.schema(readerSchema);\n    options.searchArgument(sarg, new String[] {});\n\n    try {\n      return new VectorizedRowBatchIterator(\n          file.location(), readerSchema, orcFileReader.rows(options), recordsPerBatch);\n    } catch (IOException ioe) {\n      throw new RuntimeIOException(ioe, \"Failed to get ORC rows for file: %s\", file.location());\n    }\n  }\n\n  private static class OrcRowIterator<T> implements CloseableIterator<T> {\n\n    private int nextRow;\n    private VectorizedRowBatch current;\n    private int currentBatchSize;\n\n    private final VectorizedRowBatchIterator batchIter;\n    private final OrcRowReader<T> reader;\n\n    OrcRowIterator(VectorizedRowBatchIterator batchIter, OrcRowReader<T> reader) {\n      this.batchIter = batchIter;\n      this.reader = reader;\n      current = null;\n      nextRow = 0;\n      currentBatchSize = 0;","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/orc/src/main/java/org/apache/iceberg/orc/OrcIterable.java#L123-L159","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nCloseableIterable<Record> rows = ORC.read(io).project(schema).build();\nrows.forEach(...); // RuntimeIOException: Failed to get ORC rows\n\n// after: pre-validate and handle\ntry (CloseableIterable<Record> rows = ORC.read(io).project(schema).build()) {\n  rows.forEach(...);\n} catch (RuntimeIOException e) {\n  LOG.error(\"ORC read failed: {} cause: {}\", e.getMessage(), e.getCause());\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"if (!inputFile.exists()) {\n  throw new IllegalStateException(\"ORC input file missing: \" + inputFile.location());\n}","typeGuard":null,"tryCatchPattern":"try (CloseableIterable<T> it = ORC.read(io).project(schema).build()) {\n  it.forEach(...);\n} catch (RuntimeIOException e) {\n  LOG.error(\"ORC read failed: {} cause: {}\", e.getMessage(), e.getCause());\n  if (isTransient(e.getCause())) retry();\n  throw e;\n}","preventionTips":["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"],"tags":["java","orc","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"}