{"record":{"id":"e1904d61b900d7cb","repo":"apache/iceberg","slug":"failed-to-delete-file-e1904d","errorCode":null,"errorMessage":"Failed to delete {} file {}","messagePattern":"Failed to delete (.+?) file (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"core/src/main/java/org/apache/iceberg/CatalogUtil.java","lineNumber":254,"sourceCode":"        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  }\n\n  private static void deleteFile(FileIO io, String file, String type) {\n    try {\n      io.deleteFile(file);\n    } catch (RuntimeException e) {\n      LOG.warn(\"Failed to delete {} file {}\", type, file, e);\n    }\n  }\n\n  /**\n   * Load a custom catalog implementation.\n   *\n   * <p>The catalog must have a no-arg constructor. If the class implements Configurable, a Hadoop\n   * config will be passed using Configurable.setConf. {@link Catalog#initialize(String catalogName,\n   * Map options)} is called to complete the initialization.\n   *\n   * @param impl catalog implementation full class name\n   * @param catalogName catalog name\n   * @param properties catalog properties\n   * @param hadoopConf hadoop configuration if needed\n   * @return initialized catalog object\n   * @throws IllegalArgumentException if no-arg constructor not found or error during initialization\n   */\n  public static Catalog loadCatalog(","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/CatalogUtil.java#L236-L272","documentation":"A WARN logged by the sequential single-file deleteFile helper: io.deleteFile(file) threw a RuntimeException, so this one file was not deleted while the surrounding operation (dropTableData, dropViewMetadata, deleteFiles) continues. The file remains in storage as an orphan. Deletion during drop is deliberately best-effort so a single bad file never blocks the drop.","triggerScenarios":"deleteFiles called with concurrent=false on a non-bulk FileIO, or dropTableData/dropViewMetadata cleanup paths; the individual delete throws — object missing due to concurrent cleanup, permission denied, network error, or a filesystem quirk (non-empty directory on HDFS local).","commonSituations":"Two cleanup jobs racing on the same table; restrictive bucket policies on data vs metadata prefixes; transient cloud SDK errors during large drops.","solutions":["Locate the file path in the log entry and delete it manually or via orphan-file cleanup.","Re-run drop/cleanup to catch remaining files.","Verify credentials/policies allow deletes on the affected prefix.","Retry during a quieter window if throttling is implicated."],"exampleFix":"// before\ncatalog.dropTable(identifier); // some files failed to delete\n// after\nboolean exists = catalog.tableExists(identifier);\nif (!exists) { SparkActions.get().deleteOrphanFiles(spark, tableLocation).execute(); }","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { catalog.dropTable(id); } catch (RuntimeException e) { /* drop continues anyway; run cleanup */ } finally { runOrphanCleanup(tableLocation); }","preventionTips":["Run deleteOrphanFiles periodically and after drops","Ensure uniform IAM delete permissions across prefixes","Serialize table drop and expiry jobs to avoid racing deletes","Retry transient cloud errors by re-running cleanup"],"tags":["file-delete","orphan-files","best-effort"],"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-23T08:17:48.524Z"}