{"record":{"id":"0d305f320a6d42d8","repo":"apache/iceberg","slug":"delete-failed-for-0d305f","errorCode":null,"errorMessage":"Delete failed for {}: {}","messagePattern":"Delete failed for (.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/actions/BaseSparkAction.java","lineNumber":255,"sourceCode":"   * @param deleteFunc a delete func\n   * @param files an iterator of Spark rows of the structure (path: String, type: String)\n   * @return stats on which files were deleted\n   */\n  protected DeleteSummary deleteFiles(\n      ExecutorService executorService, Consumer<String> deleteFunc, Iterator<FileInfo> files) {\n\n    DeleteSummary summary = new DeleteSummary();\n\n    Tasks.foreach(files)\n        .retry(DELETE_NUM_RETRIES)\n        .stopRetryOn(NotFoundException.class)\n        .suppressFailureWhenFinished()\n        .executeWith(executorService)\n        .onFailure(\n            (fileInfo, exc) -> {\n              String path = fileInfo.getPath();\n              String type = fileInfo.getType();\n              LOG.warn(\"Delete failed for {}: {}\", type, path, exc);\n            })\n        .run(\n            fileInfo -> {\n              String path = fileInfo.getPath();\n              String type = fileInfo.getType();\n              deleteFunc.accept(path);\n              summary.deletedFile(path, type);\n            });\n\n    return summary;\n  }\n\n  protected DeleteSummary deleteFiles(SupportsBulkOperations io, Iterator<FileInfo> files) {\n    DeleteSummary summary = new DeleteSummary();\n    Iterator<List<FileInfo>> fileGroups = Iterators.partition(files, DELETE_GROUP_SIZE);\n\n    Tasks.foreach(fileGroups)\n        .suppressFailureWhenFinished()","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/actions/BaseSparkAction.java#L237-L273","documentation":"BaseSparkAction.deleteFiles removes manifest/data files in parallel via Tasks.foreach with an executor. Individual delete failures do not abort the whole run: this warning logs each failed file (type and path) with its exception, thanks to suppressFailureWhenFinished and the onFailure handler.","triggerScenarios":"Actions like RemoveOrphanFiles/DeleteReachableFiles deleting files where some individual deleteFunc.accept(path) calls throw (permission denied, object-store 403, concurrent deletion, network errors) while the executor service processes the file set.","commonSituations":"Deleting orphan files on S3 with a role lacking s3:DeleteObject; files already removed by a concurrent GC run; throttling/rate limits during mass deletion; HDFS permission mismatches.","solutions":["Review the per-file warn logs to identify which paths failed and why (permissions vs transient).","Grant the executing credentials delete permission on the storage location (e.g. s3:DeleteObject).","Re-run the action after fixing transient issues — deletes are idempotent for already-gone files.","Enable retries or reduce parallelism if the storage layer is throttling (Tasks retry config / executor size).","Investigate anything not cleaned before removing the action's listing snapshot dependency."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Check delete permission before running the action\nFileIO io = table.io();\ntry {\n  io.deleteFile(samplePath); // or a canary object in the same location\n} catch (Exception e) {\n  throw new IllegalStateException(\"Credentials cannot delete files in \" + location, e);\n}","typeGuard":null,"tryCatchPattern":"try {\n  action.execute(result -> LOG.info(\"deleted {} files\", result.deletedDataFilesCount()));\n} catch (Exception e) {\n  LOG.warn(\"Delete run had failures; inspect per-file warns and retry\", e);\n}","preventionTips":["Grant delete permissions (e.g. s3:DeleteObject) to the job's role","Re-run RemoveOrphanFiles after fixing failures — deletes are idempotent","Reduce executor parallelism if storage throttles deletes","Check for concurrent GC jobs deleting the same files"],"tags":["spark","file-deletion","permissions","parallel-execution"],"backgroundTag":"file-delete-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"}