{"record":{"id":"ae6b2662c674764a","repo":"apache/iceberg","slug":"failed-to-close-manifest-s-ae6b26","errorCode":null,"errorMessage":"Failed to close manifest: %s","messagePattern":"Failed to close manifest: (.+?)","errorType":"exception","errorClass":"RuntimeIOException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/ManifestFilterManager.java","lineNumber":397,"sourceCode":"    }\n\n    try (ManifestReader<F> reader = newManifestReader(manifest)) {\n      PartitionSpec spec = reader.spec();\n      PartitionAndMetricsEvaluator evaluator =\n          new PartitionAndMetricsEvaluator(tableSchema, spec, deleteExpression);\n      // this assumes that the manifest doesn't have files to remove and streams through the\n      // manifest without copying data. if a manifest does have a file to remove, this will break\n      // out of the loop and move on to filtering the manifest.\n      if (manifestHasDeletedFiles(evaluator, manifest, reader)) {\n        ManifestFile filtered = filterManifestWithDeletedFiles(evaluator, manifest, reader);\n        replacedManifestsCount.incrementAndGet();\n        return filtered;\n      } else {\n        filteredManifests.put(manifest, manifest);\n        return manifest;\n      }\n    } catch (IOException e) {\n      throw new RuntimeIOException(e, \"Failed to close manifest: %s\", manifest);\n    }\n  }\n\n  private boolean canContainDeletedFiles(ManifestFile manifest, boolean trustManifestReferences) {\n    if (hasNoLiveFiles(manifest)) {\n      return false;\n    }\n\n    if (trustManifestReferences) {\n      return manifestsWithDeletes.contains(manifest.path());\n    }\n\n    return canContainDroppedFiles(manifest)\n        || canContainExpressionDeletes(manifest)\n        || canContainDroppedPartitions(manifest);\n  }\n\n  private boolean hasNoLiveFiles(ManifestFile manifest) {","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/ManifestFilterManager.java#L379-L415","documentation":"ManifestFilterManager.filterManifest builds a filtered manifest for a delete/cleanup operation and closes the manifest writer in a try/catch. If an IOException occurs during writer finalization (or iterating entries), it is rethrown as RuntimeIOException naming the source manifest. The delete operation cannot produce its filtered manifest.","triggerScenarios":"Calling MergingSnapshotProducer operations (deleteFiles, RowLevel operations, expire) where filterManifest's writer close fails due to storage errors while writing the filtered manifest for a partition.","commonSituations":"Object storage transient failures during snapshot commit; credentials expiring during large delete operations; disk/quota exhaustion; network instability to the warehouse.","solutions":["Resolve the underlying storage error from the exception cause","Retry the delete operation — it is safe to retry since no snapshot was committed","Check FileIO permissions and quota for the table's manifest location"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// confirm all manifests referenced by the snapshot are readable\nfor (ManifestFile m : snapshot.allManifests(table.io())) {\n  Preconditions.checkArgument(table.io().newInputFile(m.location()).exists(), \"Missing manifest: %s\", m.location());\n}","typeGuard":null,"tryCatchPattern":"try {\n  table.deleteFiles()/* or other MergingSnapshotProducer op */;\n} catch (RuntimeIOException e) {\n  LOG.error(\"Manifest finalization failed for {}; safe to retry\", e.getMessage(), e);\n  throw e;\n}","preventionTips":["Do not delete manifest files out-of-band; rely on expireSnapshots","Ensure long delete operations use renewable credentials","Retry failed deletes — no snapshot is committed on failure"],"tags":["io","file-write-failed","manifest-filter"],"backgroundTag":"file-write-failed","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}