{"record":{"id":"2f9f15b054ece7e7","repo":"apache/iceberg","slug":"failed-to-bulk-delete-files-2f9f15","errorCode":null,"errorMessage":"Failed to bulk delete {} files","messagePattern":"Failed to bulk delete (.+?) files","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"core/src/main/java/org/apache/iceberg/CatalogUtil.java","lineNumber":230,"sourceCode":"  }\n\n  /**\n   * Helper to delete files. Bulk deletion is used if possible.\n   *\n   * @param io FileIO for deletes\n   * @param files files to delete\n   * @param type type of files being deleted\n   * @param concurrent controls concurrent deletion. Only applicable for non-bulk FileIO\n   */\n  public static void deleteFiles(\n      FileIO io, Iterable<String> files, String type, boolean concurrent) {\n    if (io instanceof SupportsBulkOperations bulkIO) {\n      try {\n        bulkIO.deleteFiles(files);\n      } catch (BulkDeletionFailureException e) {\n        LOG.warn(\"Failed to bulk delete {} {} files\", e.numberFailedObjects(), type, e);\n      } catch (RuntimeException e) {\n        LOG.warn(\"Failed to bulk delete {} files\", type, e);\n      }\n    } else {\n      if (concurrent) {\n        concurrentlyDeleteFiles(io, files, type);\n      } else {\n        files.forEach(file -> deleteFile(io, file, type));\n      }\n    }\n  }\n\n  private static void concurrentlyDeleteFiles(FileIO io, Iterable<String> files, String type) {\n    Tasks.foreach(files)\n        .executeWith(ThreadPools.getWorkerPool())\n        .noRetry()\n        .suppressFailureWhenFinished()\n        .onFailure((file, exc) -> LOG.warn(\"Failed to delete {} file: {}\", type, file, exc))\n        .run(io::deleteFile);\n  }","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/CatalogUtil.java#L212-L248","documentation":"A WARN log when the generic bulk deletion path throws a RuntimeException other than BulkDeletionFailureException — i.e. the bulk delete operation failed wholesale rather than partially. No retry is performed; the files are left in storage and the surrounding operation (table drop) continues, so this indicates leftover/orphan files. Note this message has only the file-type placeholder, not the file path.","triggerScenarios":"SupportsBulkOperations.deleteFiles throws unexpected runtime exceptions: SDK client misconfiguration, missing credentials, network failures, or an UnsupportedOperationException from a misconfigured bulk-capable FileIO.","commonSituations":"Expired cloud credentials mid-job; wrong region/endpoint configuration in S3FileIO; custom FileIO implementations whose deleteFiles is buggy or unimplemented.","solutions":["Inspect the chained exception in the log to identify the underlying SDK/IO failure and fix credentials/region/endpoint config.","Re-run cleanup afterwards (orphan file removal) to delete the leaked files.","If using a custom FileIO, verify its deleteFiles implementation actually deletes all supplied paths.","Fall back by configuring a non-bulk FileIO path (concurrent=false) if the bulk implementation is unreliable."],"exampleFix":"// before\ncatalog.dropTable(identifier); // bulk delete blew up, files remain\n// after: sweep leftovers with explicit IO\ncatalog.dropTable(identifier);\nSparkActions.get().deleteOrphanFiles(spark, tableLocation).execute();","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { catalog.dropTable(id); } finally { runOrphanCleanup(tableLocation); }","preventionTips":["Validate FileIO credentials/region/endpoint before large cleanup jobs","Test custom FileIO deleteFiles implementations thoroughly","Read the chained cause in the log to fix root-cause config","Prefer bulk-capable FileIOs from the Iceberg distribution over custom ones"],"tags":["bulk-delete","runtime-exception","object-store"],"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"}