apache/hadoop · error · FileAlreadyExistsException

Can't provision trash for snapshottable directory {} because

Error message

Can't provision trash for snapshottable directory {} because trash path {} already exists.

What it means

Error "Can't provision trash for snapshottable directory {} because trash path {} already exists." thrown in apache/hadoop.

Source

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

    try {
      FileStatus trashFileStatus = getFileStatus(trashPath);
      boolean throwException = false;
      String errMessage = "Can't provision trash for snapshottable directory " +
          pathStr + " because trash path " + trashPath.toString() +
          " already exists.";
      if (!trashFileStatus.isDirectory()) {
        throwException = true;
        errMessage += "\r\n" +
            "WARNING: " + trashPath.toString() + " is not a directory.";
      }
      if (!trashFileStatus.getPermission().equals(trashPermission)) {
        throwException = true;
        errMessage += "\r\n" +
            "WARNING: Permission of " + trashPath.toString() +
            " differs from provided permission " + trashPermission;
      }
      if (throwException) {
        throw new FileAlreadyExistsException(errMessage);
      }
    } catch (FileNotFoundException ignored) {
      // Trash path doesn't exist. Continue
    }

    // Create trash root and set the permission
    mkdir(trashPath, trashPermission);
    setPermission(trashPath, trashPermission);

    // Print a warning if snapshot trash root feature is not enabled
    if (!isSnapshotTrashRootEnabled()) {
      DFSClient.LOG.warn("New trash is provisioned, but the snapshot trash root"
          + " feature is disabled. This new trash but won't be automatically"
          + " utilized unless the feature is enabled on the NameNode.");
    }
    return trashPath;
  }

View on GitHub (pinned to 2add963021)

Solutions

  1. Delete or rename the existing trash path, then retry provisioning.
  2. Reuse the existing trash directory if it is already correct.

When it happens

Trigger: Trash provisioning for a snapshottable directory fails because the computed trash path already exists; it must be renamed or removed first.

Common situations: See trigger scenarios.


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