apache/iceberg · error · RuntimeIOException

Failed to close manifest writer

Error message

Failed to close manifest writer

What it means

The outer catch of filterManifestWithDeletedFiles wraps any IOException not already handled — including failure to close the filtered manifest writer — into a RuntimeIOException with a generic 'Failed to close manifest writer' message (no manifest location included). The delete/copy operation aborts without committing a snapshot.

Source

Thrown at core/src/main/java/org/apache/iceberg/ManifestFilterManager.java:576

              }
            });
      } catch (IOException e) {
        throw new RuntimeIOException(e, "Failed to close manifest entries: %s", manifest);
      } finally {
        writer.close();
      }

      // return the filtered manifest as a reader
      ManifestFile filtered = writer.toManifestFile();

      // update caches
      filteredManifests.put(manifest, filtered);
      filteredManifestResults.put(filtered, Pair.of(deletedFiles, duplicateDeleteCount.get()));

      return filtered;

    } catch (IOException e) {
      throw new RuntimeIOException(e, "Failed to close manifest writer");
    }
  }

  // an evaluator that checks whether rows in a file may/must match a given expression
  // this class first partially evaluates the provided expression using the partition tuple
  // and then checks the remaining part of the expression using metrics evaluators
  private class PartitionAndMetricsEvaluator {
    private final Schema tableSchema;
    private final ResidualEvaluator residualEvaluator;
    private final StructLikeMap<Pair<InclusiveMetricsEvaluator, StrictMetricsEvaluator>>
        metricsEvaluators;

    PartitionAndMetricsEvaluator(Schema tableSchema, PartitionSpec spec, Expression expr) {
      this.tableSchema = tableSchema;
      this.residualEvaluator = ResidualEvaluator.of(spec, expr, caseSensitive);
      this.metricsEvaluators = StructLikeMap.create(spec.partitionType());
    }

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Inspect server-side/storage logs for the flush failure since this message omits the cause detail
  2. Retry the operation — snapshots are atomic and nothing was committed
  3. Validate FileIO configuration, credentials, and writable output paths before large delete jobs
Defensive patterns

Strategy: try-catch

Validate before calling

// check writable output path before producing filtered manifests
io.newInputFile(table.location() + "/metadata").exists(); // sanity-check metadata dir access

Try / catch

try {
  table.newDelete().deleteFile(dataFile).commit();
} catch (RuntimeIOException e) {
  if (e.getMessage() != null && e.getMessage().contains("Failed to close manifest writer")) {
    LOG.error("Filtered manifest writer close failed; check storage logs for the root cause", e);
  }
  throw e;
}

Prevention

When it happens

Trigger: IOException thrown by writer.close() in the finally block of filterManifestWithDeletedFiles, e.g. object store flush failure when finalizing the filtered manifest during snapshot production.

Common situations: Storage backend transient errors during delete commits; quota exhaustion; network failures to the warehouse; HDFS lease issues on long-running operations.

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