apache/hadoop · error · UnsupportedOperationException

getSnapshotListing is not supported for HttpFs on {0}. Pleas

Error message

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

What it means

FSOperations.FSGetSnapshotListing.execute() lists a directory's snapshots via DistributedFileSystem.getSnapshotListing(path), which has no counterpart in the generic FileSystem API. On any non-HDFS backing filesystem the executor throws UnsupportedOperationException (surfaced as HTTP 400 with this message), directing you to the HttpFS server's fs.defaultFS setting.

Source

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

     */
    public FSGetSnapshotListing(String path) {
      this.path = new Path(path);
    }

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

  /**
   * Executor that performs a getServerDefaults operation.
   */
  @InterfaceAudience.Private
  public static class FSGetServerDefaults
      implements FileSystemAccess.FileSystemExecutor<String> {

    /**
     * Creates a getServerDefaults executor.
     */
    public FSGetServerDefaults() {

View on GitHub (pinned to 2add963021)

Solutions

  1. Set fs.defaultFS to the HDFS nameservice in the HttpFS server config and restart
  2. Confirm the directory path is on the HDFS namespace the server mounts (not a mount-table alias resolving elsewhere)
  3. Query the NameNode via WebHDFS directly if the gateway cannot be HDFS-backed
  4. Skip snapshot-listing features when the deployment is known non-HDFS

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; GETSNAPSHOTLISTING then returns snapshot JSON -->
Defensive patterns

Strategy: try-catch

Type guard

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

Try / catch

try {
  SnapshotStatus[] snaps = fs.getSnapshotListing(path);
} catch (IOException e) {
  if (e.getMessage() != null && e.getMessage().contains("not supported for HttpFs")) {
    LOG.warn("Snapshot listing unavailable for {} (non-HDFS HttpFS)", path);
    return java.util.Collections.emptyList();
  }
  throw e;
}

Prevention

When it happens

Trigger: Client sends op=GETSNAPSHOTLISTING for a path via webhdfs:// while HttpFS's backing filesystem is LocalFileSystem or an object-store FileSystem.

Common situations: Snapshot browser tooling hitting an HttpFS gateway in front of non-HDFS storage; dev environment running HttpFS without HDFS; fs.defaultFS overwritten during a storage migration.

Related errors


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