{"record":{"id":"bb0ddecfbe1837a6","repo":"apache/iceberg","slug":"failed-to-close-manifest-writer","errorCode":null,"errorMessage":"Failed to close manifest writer","messagePattern":"Failed to close manifest writer","errorType":"exception","errorClass":"RuntimeIOException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/ManifestFilterManager.java","lineNumber":576,"sourceCode":"              }\n            });\n      } catch (IOException e) {\n        throw new RuntimeIOException(e, \"Failed to close manifest entries: %s\", manifest);\n      } finally {\n        writer.close();\n      }\n\n      // return the filtered manifest as a reader\n      ManifestFile filtered = writer.toManifestFile();\n\n      // update caches\n      filteredManifests.put(manifest, filtered);\n      filteredManifestResults.put(filtered, Pair.of(deletedFiles, duplicateDeleteCount.get()));\n\n      return filtered;\n\n    } catch (IOException e) {\n      throw new RuntimeIOException(e, \"Failed to close manifest writer\");\n    }\n  }\n\n  // an evaluator that checks whether rows in a file may/must match a given expression\n  // this class first partially evaluates the provided expression using the partition tuple\n  // and then checks the remaining part of the expression using metrics evaluators\n  private class PartitionAndMetricsEvaluator {\n    private final Schema tableSchema;\n    private final ResidualEvaluator residualEvaluator;\n    private final StructLikeMap<Pair<InclusiveMetricsEvaluator, StrictMetricsEvaluator>>\n        metricsEvaluators;\n\n    PartitionAndMetricsEvaluator(Schema tableSchema, PartitionSpec spec, Expression expr) {\n      this.tableSchema = tableSchema;\n      this.residualEvaluator = ResidualEvaluator.of(spec, expr, caseSensitive);\n      this.metricsEvaluators = StructLikeMap.create(spec.partitionType());\n    }\n","sourceCodeStart":558,"sourceCodeEnd":594,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/ManifestFilterManager.java#L558-L594","documentation":"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.","triggerScenarios":"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.","commonSituations":"Storage backend transient errors during delete commits; quota exhaustion; network failures to the warehouse; HDFS lease issues on long-running operations.","solutions":["Inspect server-side/storage logs for the flush failure since this message omits the cause detail","Retry the operation — snapshots are atomic and nothing was committed","Validate FileIO configuration, credentials, and writable output paths before large delete jobs"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// check writable output path before producing filtered manifests\nio.newInputFile(table.location() + \"/metadata\").exists(); // sanity-check metadata dir access","typeGuard":null,"tryCatchPattern":"try {\n  table.newDelete().deleteFile(dataFile).commit();\n} catch (RuntimeIOException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Failed to close manifest writer\")) {\n    LOG.error(\"Filtered manifest writer close failed; check storage logs for the root cause\", e);\n  }\n  throw e;\n}","preventionTips":["Because this message omits location/cause, correlate with storage-side logs","Enable verbose FileIO logging during delete operations","Keep commit operations short to limit exposure to transient failures"],"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"}