apache/iceberg · critical · UncheckedIOException

Failed to close equality delta writer

Error message

Failed to close equality delta writer

What it means

PartitionedDeltaWriter.close() closes all underlying RowDataDeltaWriters via Tasks, collecting IOExceptions. If any writer fails to close, the IOException is wrapped in an UncheckedIOException with this message. It indicates a failure flushing/closing files or manifests during writer teardown.

Source

Thrown at flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/sink/PartitionedDeltaWriter.java:97

      writer = new RowDataDeltaWriter(copiedKey, dvFileWriter());
      writers.put(copiedKey, writer);
    }

    return writer;
  }

  @Override
  public void close() {
    try {
      super.close();
      Tasks.foreach(writers.values())
          .throwFailureWhenFinished()
          .noRetry()
          .run(RowDataDeltaWriter::close, IOException.class);

      writers.clear();
    } catch (IOException e) {
      throw new UncheckedIOException("Failed to close equality delta writer", e);
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Inspect the cause (UncheckedIOException.getCause()) for the real writer-level IOException and fix that root problem.
  2. Check filesystem/object-store connectivity, credentials, and disk space on local spill directories.
  3. Retry the failed checkpoint/task; transient object store errors are the most common cause.
  4. Verify no double-close is happening in custom code that also closes writers on failure paths.
Defensive patterns

Strategy: retry

Try / catch

// at checkpoint/failure handler
try {
  writer.close();
} catch (UncheckedIOException e) {
  LOG.error("Writer close failed; cause: {}", e.getCause(), e);
  // let Flink restart strategy retry the checkpoint/task
  throw e;
}

Prevention

When it happens

Trigger: Closing the partitioned writer when an underlying delta writer (data file writer or equality-delete writer) throws IOException during close — e.g. failing to close an Avro/Parquet file, closing an already-closed writer, or filesystem errors during flush.

Common situations: Underlying object store issues (transient S3/HDFS failures) during checkpoint; task failure/cancellation racing with close; disk full on local buffer directories.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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