apache/iceberg · error · UncheckedIOException

Can't get Stripe's length from the file writer with path: %s

Error message

Can't get Stripe's length from the file writer with path: %s.

What it means

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.

Source

Thrown at orc/src/main/java/org/apache/iceberg/orc/OrcFileAppender.java:131

  public long length() {
    if (isClosed) {
      return file.toInputFile().getLength();
    }

    long estimateMemory = writer.estimateMemory();

    long dataLength = 0;
    try {
      List<StripeInformation> stripes = writer.getStripes();
      if (!stripes.isEmpty()) {
        StripeInformation stripeInformation = stripes.get(stripes.size() - 1);
        dataLength =
            stripeInformation != null
                ? stripeInformation.getOffset() + stripeInformation.getLength()
                : 0;
      }
    } catch (IOException e) {
      throw new UncheckedIOException(
          String.format(
              "Can't get Stripe's length from the file writer with path: %s.", file.location()),
          e);
    }

    // This value is an estimate, not the actual length.
    return (long)
        Math.ceil(dataLength + (estimateMemory + (long) batch.size * avgRowByteSize) * 0.2);
  }

  @Override
  public List<Long> splitOffsets() {
    Preconditions.checkState(isClosed, "File is not yet closed");
    try {
      List<StripeInformation> stripes = writer.getStripes();
      return Collections.unmodifiableList(Lists.transform(stripes, StripeInformation::getOffset));
    } catch (IOException e) {
      throw new RuntimeIOException(

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Check the wrapped IOException cause for the storage failure (network, permission, corrupt writer state) and address it.
  2. Retry the write; ensure the OutputFile/storage backend is healthy before starting the append.
  3. Avoid calling length() mid-write if you only need the final size — read it from the committed file after close().

Example fix

// before
long len = appender.length(); // UncheckedIOException if writer I/O fails

// after
try {
  long len = appender.length(); // estimate only; storage must be healthy
} catch (UncheckedIOException e) {
  LOG.error("Cannot estimate ORC length: {}", e.getCause());
  throw e;
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  long est = appender.length();
} catch (UncheckedIOException e) {
  LOG.error("Stripe length lookup failed: {}", e.getCause());
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/31017aabe36bf432. Report an issue: GitHub.