{"record":{"id":"e6e4467a21d2f7eb","repo":"apache/hadoop","slug":"failed-delete-src","errorCode":null,"errorMessage":"Failed delete {src}","messagePattern":"Failed delete (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-federation-balance/src/main/java/org/apache/hadoop/tools/fedbalance/TrashProcedure.java","lineNumber":82,"sourceCode":"  }\n\n  /**\n   * Delete source path to trash.\n   */\n  void moveToTrash() throws IOException {\n    Path src = context.getSrc();\n    if (srcFs.exists(src)) {\n      TrashOption trashOption = context.getTrashOpt();\n      switch (trashOption) {\n      case TRASH:\n        conf.setFloat(FS_TRASH_INTERVAL_KEY, 60);\n        if (!Trash.moveToAppropriateTrash(srcFs, src, conf)) {\n          throw new IOException(\"Failed move \" + src + \" to trash.\");\n        }\n        break;\n      case DELETE:\n        if (!srcFs.delete(src, true)) {\n          throw new IOException(\"Failed delete \" + src);\n        }\n        LOG.info(\"{} is deleted.\", src);\n        break;\n      case SKIP:\n        break;\n      default:\n        throw new IOException(\"Unexpected trash option=\" + trashOption);\n      }\n    }\n  }\n\n  public FedBalanceContext getContext() {\n    return context;\n  }\n\n  @Override\n  public void write(DataOutput out) throws IOException {\n    super.write(out);","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-federation-balance/src/main/java/org/apache/hadoop/tools/fedbalance/TrashProcedure.java#L64-L100","documentation":"The DELETE branch of TrashProcedure.moveToTrash(): srcFs.delete(src, true) returned false rather than throwing, which the code converts into IOException. Hadoop's FileSystem.delete signals many failures via the boolean, so this means the recursive delete did not succeed even though src existed a moment earlier. As with 5051, the balance copy has already completed - only source removal failed.","triggerScenarios":"delete(src, recursive=true) returning false: the path disappeared between the exists() check and the delete (race with another process), the user lacks permission to remove entries in src's parent, or the FileSystem implementation reports failure without an exception.","commonSituations":"Another job (compaction, cleaner, operator) deleting src concurrently; permission edge cases on the parent directory; running the balance user without delete rights on that subtree.","solutions":["Re-check whether src still exists; if it is already gone the intended end state is reached and the error can be ignored.","Verify the balance user has write permission on src's parent directory (needed to remove the entry).","Retry the procedure, or delete manually with 'hdfs dfs -rm -r <src>' after confirming dst is complete and consistent."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  // DELETE disposal stage of TrashProcedure\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Failed delete\")) {\n    // re-check existence: if src is gone the goal is achieved; else fix permissions and retry\n  }\n}","preventionTips":["Grant the balance user delete permission on src and its parent for the whole run, not just read.","Ensure no other process deletes or moves src while the balance job is finishing."],"tags":["fedbalance","federation-balance","recursive-delete","cleanup","hdfs-permissions"],"backgroundTag":"recursive-delete-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}