apache/iceberg · warning
Failed to delete: {}
Error message
Failed to delete: {} What it means
WARN logged by RewriteDataFilesCommitManager.abortFileGroup when deleting the files added by a rewrite group whose commit failed. abortFileGroup is invoked after a failed or cancelled commit to remove the new data files; each delete failure is logged individually and suppressed so the whole cleanup pass completes.
Source
Thrown at core/src/main/java/org/apache/iceberg/actions/RewriteDataFilesCommitManager.java:128
}
rewrite.commit();
}
/**
* Clean up a specified file set by removing any files created for that operation, should not
* throw any exceptions
*
* @param fileGroup group of files which has already been rewritten
*/
public void abortFileGroup(RewriteFileGroup fileGroup) {
Preconditions.checkState(
fileGroup.addedFiles() != null, "Cannot abort a fileGroup that was not rewritten");
Tasks.foreach(fileGroup.addedFiles())
.noRetry()
.suppressFailureWhenFinished()
.onFailure((dataFile, exc) -> LOG.warn("Failed to delete: {}", dataFile.location(), exc))
.run(dataFile -> table.io().deleteFile(dataFile.location()));
}
public void commitOrClean(Set<RewriteFileGroup> rewriteGroups) {
try {
commitFileGroups(rewriteGroups);
} catch (CommitStateUnknownException e) {
LOG.error(
"Commit state unknown for {}, cannot clean up files because they may have been committed successfully.",
rewriteGroups,
e);
throw e;
} catch (Exception e) {
if (e instanceof CleanableFailure) {
LOG.error(
"Cannot commit groups {}, attempting to clean up written files", rewriteGroups, e);
rewriteGroups.forEach(this::abortFileGroup);
}View on GitHub (pinned to 86d9c8fc54)
Solutions
- Read the chained cause in the WARN to find the delete error (ACL, throttling, missing file).
- Verify table.io() credentials/permissions allow deletion in the table's data directory.
- Re-run the rewrite; uncommitted leftovers can be cleaned with orphan file removal.
- For 'already deleted' errors, no action needed — files were never referenced by a snapshot.
Example fix
// before
table.io().deleteFile(dataFile.location());
// after
try {
table.io().deleteFile(dataFile.location());
} catch (RuntimeException e) {
LOG.warn("Skipping already-deleted file {}", dataFile.location(), e);
} Defensive patterns
Strategy: fallback
Validate before calling
// ensure table.io() supports deletion
try (// probe: table.io().deleteFile on a temp file in data dir if feasible) {} Try / catch
try {
rewrite.commit();
} catch (Exception e) {
rewrite.abortFileGroups(); // deletes may warn; leftover files cleaned by expire orphans
throw e;
} Prevention
- Use credentials with delete rights on the data directory.
- Throttle object-store operations to avoid rate-limit failures during bulk delete.
- Treat non-404 delete failures as actionable and investigate the chained cause.
When it happens
Trigger: commitFileGroups fails (or is aborted), abortFileGroup runs Tasks.foreach over fileGroup.addedFiles(), and table.io().deleteFile(dataFile.location()) throws for at least one file.
Common situations: Object store permission errors or rate limiting during cleanup; file already deleted by a concurrent operation; transient network failure during bulk deletes.
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
- Failed to delete: {}
- Failed to commit rewrite, cleaning up rewritten files
- The iceberg transaction has been committed, but we failed to
- Failed to delete uncommitted DV {} for table {} task {}
- Failed to delete {} ({})
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/ee6eb9700306624b.
Report an issue: GitHub.