apache/iceberg · warning
Delete failed for {}: {}
Error message
Delete failed for {}: {} What it means
BaseSparkAction.deleteFiles deletes rewritten/orphaned data files in parallel with Tasks and, on individual deletion failures, logs this warning per failed file (type and path plus exception) instead of aborting the whole action. Failures are suppressed so the rewrite/import completes even if some files could not be removed.
Source
Thrown at spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/actions/BaseSparkAction.java:255
* @param deleteFunc a delete func
* @param files an iterator of Spark rows of the structure (path: String, type: String)
* @return stats on which files were deleted
*/
protected DeleteSummary deleteFiles(
ExecutorService executorService, Consumer<String> deleteFunc, Iterator<FileInfo> files) {
DeleteSummary summary = new DeleteSummary();
Tasks.foreach(files)
.retry(DELETE_NUM_RETRIES)
.stopRetryOn(NotFoundException.class)
.suppressFailureWhenFinished()
.executeWith(executorService)
.onFailure(
(fileInfo, exc) -> {
String path = fileInfo.getPath();
String type = fileInfo.getType();
LOG.warn("Delete failed for {}: {}", type, path, exc);
})
.run(
fileInfo -> {
String path = fileInfo.getPath();
String type = fileInfo.getType();
deleteFunc.accept(path);
summary.deletedFile(path, type);
});
return summary;
}
protected DeleteSummary deleteFiles(SupportsBulkOperations io, Iterator<FileInfo> files) {
DeleteSummary summary = new DeleteSummary();
Iterator<List<FileInfo>> fileGroups = Iterators.partition(files, DELETE_GROUP_SIZE);
Tasks.foreach(fileGroups)
.suppressFailureWhenFinished()View on GitHub (pinned to 86d9c8fc54)
Solutions
- Inspect the WARN entries for the failed paths and re-run the action — orphaned files will be retried on the next cleanup pass.
- Throttle delete concurrency (reduce executor threads) if the failures are object-store rate limiting.
- Fix FileIO credentials/permissions so the principal can delete objects at the reported paths.
- If deletions must be guaranteed, replace suppressFailureWhenFinished behavior by running deletes with Tasks that retry or fail fast.
Defensive patterns
Strategy: retry
Validate before calling
// verify delete permission up front io.deleteFile(probePath); // or check IAM policy covers s3:DeleteObject on table location
Prevention
- Tune delete executor concurrency to avoid object-store throttling.
- Ensure the job principal has delete permissions on all table locations.
- Schedule periodic orphan-file cleanup so failed deletes are retried later.
- Avoid running multiple concurrent cleanup jobs over the same table.
When it happens
Trigger: During any BaseSparkAction-derived action's file cleanup phase, the deleteFunc (FileIO.deleteFile) throws for specific files — e.g. transient S3 errors, permission issues, or files already deleted by another process.
Common situations: Object-store throttling (S3 503 slow-down) under high delete concurrency; concurrent garbage collection deleting files first; IAM credentials lacking s3:DeleteObject on some paths.
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
- Delete failed for {}: {}
- Interrupted when waiting for deletions to complete
- Cannot commit rewrite because of a ValidationException or Co
- Cannot commit rewrite because of a ValidationException or Co
- Unable to determine whether certain files are orphan. Metada
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/0b25890a6c905ba5.
Report an issue: GitHub.