apache/hadoop · error · UnsupportedOperationException

Cannot provisionSnapshotTrash through a symlink to a non-Dis

Error message

Cannot provisionSnapshotTrash through a symlink to a non-DistributedFileSystem: {} -> {}

What it means

Error "Cannot provisionSnapshotTrash through a symlink to a non-DistributedFileSystem: {} -> {}" thrown in apache/hadoop.

Source

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

   * @param trashPermission Expected FsPermission of the trash root.
   * @return Path of the provisioned trash root
   */
  public Path provisionSnapshotTrash(final Path path,
      final FsPermission trashPermission) throws IOException {
    Path absF = fixRelativePart(path);
    return new FileSystemLinkResolver<Path>() {
      @Override
      public Path doCall(Path p) throws IOException {
        return provisionSnapshotTrash(getPathName(p), trashPermission);
      }

      @Override
      public Path next(FileSystem fs, Path p) throws IOException {
        if (fs instanceof DistributedFileSystem) {
          DistributedFileSystem myDfs = (DistributedFileSystem)fs;
          return myDfs.provisionSnapshotTrash(p, trashPermission);
        }
        throw new UnsupportedOperationException(
            "Cannot provisionSnapshotTrash through a symlink to" +
            " a non-DistributedFileSystem: " + fs + " -> " + p);
      }
    }.resolve(this, absF);
  }

  private Path provisionSnapshotTrash(
      String pathStr, FsPermission trashPermission) throws IOException {
    Path path = new Path(pathStr);
    // Given path must be a snapshottable directory
    FileStatus fileStatus = getFileStatus(path);
    if (!fileStatus.isSnapshotEnabled()) {
      throw new IllegalArgumentException(
          path + " is not a snapshottable directory.");
    }

    // Check if trash root already exists
    Path trashPath = new Path(path, FileSystem.TRASH_PREFIX);

View on GitHub (pinned to 2add963021)

Solutions

  1. Call provisionSnapshotTrash on the real DistributedFileSystem path.
  2. Resolve symlinks before provisioning snapshot trash.

When it happens

Trigger: provisionSnapshotTrash is invoked through a symlink whose target is not a DistributedFileSystem, so snapshot trash cannot be provisioned.

Common situations: See trigger scenarios.


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