{"record":{"id":"17dd2cf99fce6618","repo":"apache/hadoop","slug":"delete-on-root-is-not-supported","errorCode":null,"errorMessage":"Delete on root is not supported.","messagePattern":"Delete on root is not supported\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-azure-datalake/src/main/java/org/apache/hadoop/fs/adl/AdlFileSystem.java","lineNumber":606,"sourceCode":"   *                  true or false.\n   * @return true if delete is successful else false.\n   * @throws IOException when system error, internal server error or user error\n   */\n  @Override\n  public boolean delete(final Path path, final boolean recursive)\n      throws IOException {\n    statistics.incrementWriteOps(1);\n    String relativePath = toRelativeFilePath(path);\n    // Delete on root directory not supported.\n    if (relativePath.equals(\"/\")) {\n      // This is important check after recent commit\n      // HADOOP-12977 and HADOOP-13716 validates on root for\n      // 1. if root is empty and non recursive delete then return false.\n      // 2. if root is non empty and non recursive delete then throw exception.\n      if (!recursive\n          && adlClient.enumerateDirectory(toRelativeFilePath(path), 1).size()\n          > 0) {\n        throw new IOException(\"Delete on root is not supported.\");\n      }\n      return false;\n    }\n\n    return recursive ?\n        adlClient.deleteRecursive(relativePath) :\n        adlClient.delete(relativePath);\n  }\n\n  /**\n   * Make the given file and all non-existent parents into\n   * directories. Has the semantics of Unix 'mkdir -p'.\n   * Existence of the directory hierarchy is not an error.\n   *\n   * @param path       path to create\n   * @param permission to apply to path\n   */\n  @Override","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-azure-datalake/src/main/java/org/apache/hadoop/fs/adl/AdlFileSystem.java#L588-L624","documentation":"Error \"Delete on root is not supported.\" thrown in apache/hadoop.","triggerScenarios":"delete() is called on the ADL filesystem root.","commonSituations":"See trigger scenarios.","solutions":["Do not attempt to delete the ADL root '/'; delete specific directories instead.","Guard application code against root-path deletes."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}