{"record":{"id":"31017aabe36bf432","repo":"apache/iceberg","slug":"can-t-get-stripe-s-length-from-the-file-writer-wit","errorCode":null,"errorMessage":"Can't get Stripe's length from the file writer with path: %s.","messagePattern":"Can't get Stripe's length from the file writer with path: (.+?)\\.","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"orc/src/main/java/org/apache/iceberg/orc/OrcFileAppender.java","lineNumber":131,"sourceCode":"  public long length() {\n    if (isClosed) {\n      return file.toInputFile().getLength();\n    }\n\n    long estimateMemory = writer.estimateMemory();\n\n    long dataLength = 0;\n    try {\n      List<StripeInformation> stripes = writer.getStripes();\n      if (!stripes.isEmpty()) {\n        StripeInformation stripeInformation = stripes.get(stripes.size() - 1);\n        dataLength =\n            stripeInformation != null\n                ? stripeInformation.getOffset() + stripeInformation.getLength()\n                : 0;\n      }\n    } catch (IOException e) {\n      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(","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/orc/src/main/java/org/apache/iceberg/orc/OrcFileAppender.java#L113-L149","documentation":"OrcFileAppender.length() estimates the written file size by reading stripe information from the in-progress ORC Writer. If querying the writer for stripe data throws an IOException, it is wrapped in UncheckedIOException with the writer's path. The resulting value is documented as an estimate only.","triggerScenarios":"Calling appender.length() (directly or via the OutputFile 'get'/length reporting path) while the ORC Writer is open and its internal stripe lookup (writing the footer/extracting StripeInformation) throws IOException — typically due to an underlying storage failure.","commonSituations":"Task engines polling file length during a long write to an HDFS/S3-backed output that develops connectivity problems; length() called after the writer entered a bad state or on a failed writer instance.","solutions":["Check the wrapped IOException cause for the storage failure (network, permission, corrupt writer state) and address it.","Retry the write; ensure the OutputFile/storage backend is healthy before starting the append.","Avoid calling length() mid-write if you only need the final size — read it from the committed file after close()."],"exampleFix":"// before\nlong len = appender.length(); // UncheckedIOException if writer I/O fails\n\n// after\ntry {\n  long len = appender.length(); // estimate only; storage must be healthy\n} catch (UncheckedIOException e) {\n  LOG.error(\"Cannot estimate ORC length: {}\", e.getCause());\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  long est = appender.length();\n} catch (UncheckedIOException e) {\n  LOG.error(\"Stripe length lookup failed: {}\", e.getCause());\n  throw e;\n}","preventionTips":["Do not poll length() aggressively during writes; storage hiccups surface as this error","Read the final size from the committed file after close() when possible","Keep the storage backend healthy; this error is almost always a symptom of an I/O failure"],"tags":["java","orc","io","file-size"],"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"}