apache/hadoop · error · UnsupportedOperationException

getSnapshottableDirListing is not supported for HttpFs on {0

Error message

getSnapshottableDirListing is not supported for HttpFs on {0}. Please check your fs.defaultFS configuration

What it means

FSOperations.FSGetSnapshottableDirListing.execute() lists snapshottable directories through DistributedFileSystem.getSnapshottableDirListing(), an HDFS-only API. If the filesystem HttpFS opened is anything else, it throws UnsupportedOperationException (delivered as HTTP 400 with this text), because snapshottable-dir tracking simply does not exist outside HDFS.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/FSOperations.java:1990

     * Creates a getSnapshottableDirListing executor.
     */
    public FSGetSnapshottableDirListing() {
    }

    /**
     * Executes the filesystem operation.
     * @param fs filesystem instance to use.
     * @return A JSON string of all snapshottable directories.
     * @throws IOException thrown if an IO error occurred.
     */
    @Override
    public String execute(FileSystem fs) throws IOException {
      SnapshottableDirectoryStatus[] sds = null;
      if (fs instanceof DistributedFileSystem) {
        DistributedFileSystem dfs = (DistributedFileSystem) fs;
        sds = dfs.getSnapshottableDirListing();
      } else {
        throw new UnsupportedOperationException("getSnapshottableDirListing is "
            + "not supported for HttpFs on " + fs.getClass()
            + ". Please check your fs.defaultFS configuration");
      }
      return JsonUtil.toJsonString(sds);
    }
  }

  /**
   *  Executor that performs a getSnapshotListing operation.
   */
  @InterfaceAudience.Private
  public static class FSGetSnapshotListing implements
      FileSystemAccess.FileSystemExecutor<String> {
    private Path path;

    /**
     * Creates a getSnapshotDiff executor.
     * @param path directory path of the snapshots to be examined.

View on GitHub (pinned to 2add963021)

Solutions

  1. Configure and reload the HttpFS server with fs.defaultFS=hdfs://<nameservice>
  2. Verify the server actually binds HDFS by checking startup logs for the filesystem implementation it loaded
  3. Use WebHDFS (webhdfs://namenode:9870) directly for snapshottable-dir queries
  4. If non-HDFS backing is intentional, remove snapshottable-dir listing from the client workflow

Example fix

<!-- before: httpfs-site.xml -->
<property><name>fs.defaultFS</name><value>file:///</value></property>
<!-- after -->
<property><name>fs.defaultFS</name><value>hdfs://ns1</value></property>
<!-- restart HttpFS so the executor takes the DistributedFileSystem branch -->
Defensive patterns

Strategy: try-catch

Type guard

static DistributedFileSystem asDfs(FileSystem fs) {
  return fs instanceof DistributedFileSystem ? (DistributedFileSystem) fs : null;
}

Try / catch

try {
  SnapshottableDirectoryStatus[] s = fs.getSnapshottableDirListing();
} catch (IOException e) {
  if (e.getMessage() != null && e.getMessage().contains("not supported for HttpFs")) {
    LOG.warn("Snapshottable-dir listing unavailable: HttpFS not HDFS-backed");
    return new SnaphottableDirectoryStatus[0];
  }
  throw e;
}

Prevention

When it happens

Trigger: Client sends op=GETSNAPSHOTTABLEDIRLIST via webhdfs:// against an HttpFS server whose fs.defaultFS is file:/// or an object-store scheme.

Common situations: Snapshot-management UIs defaulting to the HttpFS gateway; HttpFS installed standalone (no HDFS) for testing; production gateway repointed to non-HDFS storage without updating clients.

Related errors


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