{"record":{"id":"3e801dab30a069b5","repo":"apache/iceberg","slug":"failed-to-get-stripe-information-from-writer-for","errorCode":null,"errorMessage":"Failed to get stripe information from writer for: %s","messagePattern":"Failed to get stripe information from writer for: (.+?)","errorType":"exception","errorClass":"RuntimeIOException","httpStatus":null,"severity":"error","filePath":"orc/src/main/java/org/apache/iceberg/orc/OrcFileAppender.java","lineNumber":149,"sourceCode":"      throw new UncheckedIOException(\n          String.format(\n              \"Can't get Stripe's length from the file writer with path: %s.\", file.location()),\n          e);\n    }\n\n    // This value is an estimate, not the actual length.\n    return (long)\n        Math.ceil(dataLength + (estimateMemory + (long) batch.size * avgRowByteSize) * 0.2);\n  }\n\n  @Override\n  public List<Long> splitOffsets() {\n    Preconditions.checkState(isClosed, \"File is not yet closed\");\n    try {\n      List<StripeInformation> stripes = writer.getStripes();\n      return Collections.unmodifiableList(Lists.transform(stripes, StripeInformation::getOffset));\n    } catch (IOException e) {\n      throw new RuntimeIOException(\n          e, \"Failed to get stripe information from writer for: %s\", file.location());\n    }\n  }\n\n  @Override\n  public void close() throws IOException {\n    if (!isClosed) {\n      try {\n        if (batch.size > 0) {\n          writer.addRowBatch(batch);\n          batch.reset();\n        }\n      } finally {\n        writer.close();\n        this.isClosed = true;\n      }\n    }\n  }","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/orc/src/main/java/org/apache/iceberg/orc/OrcFileAppender.java#L131-L167","documentation":"splitOffsets() returns the byte offsets of each ORC stripe for split planning, and it requires the appender to be closed so the stripe list is final. If retrieving stripes from the closed Writer throws an IOException, a RuntimeIOException with the file location is thrown. It also enforces the state precondition that the file has already been closed.","triggerScenarios":"Calling appender.splitOffsets() before close() (IllegalStateException 'File is not yet closed'), or after close() when writer.getStripes() throws IOException due to storage/backend problems reading stripe metadata.","commonSituations":"Commit-time split-offset collection racing with or preceding appender close; storage backend errors when finalizing ORC files on S3/HDFS; framework code calling splitOffsets on an appender whose close failed midway.","solutions":["Always close() the appender fully and successfully before calling splitOffsets().","Inspect the wrapped IOException cause if getStripes fails after close; re-run the write task so the file is rewritten cleanly.","Guard framework glue code so splitOffsets is only invoked in the commit phase after successful close."],"exampleFix":"// before\nList<Long> offsets = appender.splitOffsets(); // IllegalStateException / RuntimeIOException\nappender.close();\n\n// after\nappender.close();\nList<Long> offsets = appender.splitOffsets(); // only after successful close","handlingStrategy":"validation","validationCode":"if (!appender.isClosed()) {\n  throw new IllegalStateException(\"Call close() before splitOffsets()\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  List<Long> offsets = appender.splitOffsets();\n} catch (RuntimeIOException | IllegalStateException e) {\n  LOG.error(\"splitOffsets failed: {}\", e.getMessage());\n  throw e;\n}","preventionTips":["Enforce close-before-commit ordering in appender glue code","Treat a failed close as a failed write; never read stripe metadata from a failed writer","Retry the whole write task if getStripes fails"],"tags":["java","orc","io","lifecycle"],"backgroundTag":"invalid-state-transition","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"}