apache/hadoop · error · AbfsRestOperationException

DirectoryNotEmpty

DirectoryNotEmpty

Error message

The recursive query parameter value must be true to delete a non-empty directory

What it means

Error "The recursive query parameter value must be true to delete a non-empty directory" thrown in apache/hadoop.

Source

Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/BlobDeleteHandler.java:111

    deleteCount.incrementAndGet();
    return true;
  }

  /**
   * Orchestrate the delete operation.
   *
   * @return true if the delete operation is successful.
   * @throws AzureBlobFileSystemException if deletion fails due to server error or path doesn't exist.
   */
  public boolean execute() throws AzureBlobFileSystemException {
    /*
     * ABFS is not aware if it's a file or directory. So, we need to list the
     * path and delete the listed objects. The listing returns the children of
     * the path and not the path itself.
     */
    listRecursiveAndTakeAction();
    if (nonRecursiveDeleteDirectoryFailed) {
      throw new AbfsRestOperationException(HTTP_CONFLICT,
          NON_EMPTY_DIRECTORY_DELETE.getErrorCode(),
          NON_EMPTY_DIRECTORY_DELETE.getErrorMessage(),
          new PathIOException(path.toString(),
              "Non-recursive delete of non-empty directory"));
    }
    tracingContext.setOperatedBlobCount(deleteCount.get() + 1);
    /*
     * If path is actually deleted.
     */
    boolean deleted;
    try {
      /*
       * Delete the required path.
       * Directory should be safely deleted as the path might be implicit.
       */
      deleted = recursive ? safeDelete(path) : deleteInternal(path);
    } finally {
      tracingContext.setOperatedBlobCount(0);

View on GitHub (pinned to 2add963021)

Solutions

  1. Call delete(path, true) with recursive=true for non-empty directories.
  2. Empty the directory first if a non-recursive delete is intended.

When it happens

Trigger: A non-recursive delete targets a non-empty directory on the Blob endpoint.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/808b99f50fa32761. Report an issue: GitHub.