apache/iceberg · error · UncheckedIOException

Failed to close current writer

Error message

Failed to close current writer

What it means

RollingManifestWriter.closeCurrentWriter wraps an IOException from closing the current manifest writer in an UncheckedIOException. This means the underlying manifest file could not be flushed/closed (I/O failure to the file store), so the manifest being rolled may be incomplete.

Source

Thrown at core/src/main/java/org/apache/iceberg/RollingManifestWriter.java:133

    }

    return currentWriter;
  }

  private boolean shouldRollToNewFile() {
    return currentFileRows % ROWS_DIVISOR == 0 && currentWriter.length() >= targetFileSizeInBytes;
  }

  private void closeCurrentWriter() {
    if (currentWriter != null) {
      try {
        currentWriter.close();
        ManifestFile currentFile = currentWriter.toManifestFile();
        manifestFiles.add(currentFile);
        this.currentWriter = null;
        this.currentFileRows = 0;
      } catch (IOException e) {
        throw new UncheckedIOException("Failed to close current writer", e);
      }
    }
  }

  @Override
  public void close() throws IOException {
    if (!closed) {
      closeCurrentWriter();
      this.closed = true;
    }
  }

  public List<ManifestFile> toManifestFiles() {
    Preconditions.checkState(closed, "Cannot get ManifestFile list from unclosed writer");
    return manifestFiles;
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Inspect the chained IOException cause for the storage-level failure and address it (credentials, connectivity, quota).
  2. Retry the operation; the failed manifest is discarded since it was never committed.
  3. Verify write permissions and available space on the table's write location.
Defensive patterns

Strategy: retry

Try / catch

try (RollingManifestWriter w = new RollingManifestWriter(...)) { ... } catch (UncheckedIOException e) {
  LOG.error("manifest close failed", e.getCause());
  throw e;
}

Prevention

When it happens

Trigger: currentWriter or close triggers a manifest writer close that throws IOException — underlying storage failure, network interruption, quota/full disk, or permissions problem on the manifest output location.

Common situations: S3/HDFS transient failures during commit; credential expiry mid-write; disk full; concurrent deletion of the output file.

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/e5a29bf40c930252. Report an issue: GitHub.