apache/hadoop · error · FileAlreadyExistsException

Will not provision new trash directory for encryption zone

Error message

Will not provision new trash directory for encryption zone {}. Path already exists.

What it means

provisionEZTrash refuses to create the zone trash directory because a path already exists there (extra warnings are appended when it is not a directory or has wrong permissions); provisioning would clobber existing data.

Solutions

  1. Remove or rename the existing trash path before provisioning new EZ trash.
  2. Skip provisioning if the trash directory already exists and is valid.
Defensive patterns

Strategy: validation

When it happens

Trigger: provisioning an encryption-zone trash directory is requested, but the trash path for that zone already exists, so no new directory is created.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java:3143

          "encryption zone. Do you mean " + ez.getPath() + "?");
    }

    // check if the trash directory exists
    Path trashPath = new Path(ez.getPath(), FileSystem.TRASH_PREFIX);
    try {
      FileStatus trashFileStatus = getFileStatus(trashPath);
      String errMessage = "Will not provision new trash directory for " +
          "encryption zone " + ez.getPath() + ". Path already exists.";
      if (!trashFileStatus.isDirectory()) {
        errMessage += "\r\n" +
            "Warning: " + trashPath.toString() + " is not a directory";
      }
      if (!trashFileStatus.getPermission().equals(trashPermission)) {
        errMessage += "\r\n" +
            "Warning: the permission of " +
            trashPath.toString() + " is not " + trashPermission;
      }
      throw new FileAlreadyExistsException(errMessage);
    } catch (FileNotFoundException ignored) {
      // no trash path
    }

    // Update the permission bits
    mkdir(trashPath, trashPermission);
    setPermission(trashPath, trashPermission);
  }

  /**
   * HDFS only.
   *
   * Provision snapshottable directory trash.
   * @param path Path to a snapshottable directory.
   * @param trashPermission Expected FsPermission of the trash root.
   * @return Path of the provisioned trash root
   */
  public Path provisionSnapshotTrash(final Path path,

View on GitHub (pinned to 2add963021)