apache/hadoop · error · UnsupportedOperationException

allowSnapshot is not supported for HttpFs on {0}. Please che

Error message

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

What it means

FSOperations.FSAllowSnapshot.execute() implements ALLOWSNAPSHOT only when the FileSystem the HttpFS server opened (via the FileSystemAccess service, driven by the server-side fs.defaultFS) is a DistributedFileSystem; HDFS snapshot RPCs have no generic FileSystem equivalent. For any other backing filesystem it throws UnsupportedOperationException, which HttpExceptionUtils maps to HTTP 400 and the client sees as an IOException with this text.

Source

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

     * Creates a allowSnapshot executor.
     * @param path directory path to allow snapshot.
     */
    public FSAllowSnapshot(String path) {
      this.path = new Path(path);
    }

    /**
     * Executes the filesystem operation.
     * @param fs filesystem instance to use.
     * @throws IOException thrown if an IO error occurred.
     */
    @Override
    public Void execute(FileSystem fs) throws IOException {
      if (fs instanceof DistributedFileSystem) {
        DistributedFileSystem dfs = (DistributedFileSystem) fs;
        dfs.allowSnapshot(path);
      } else {
        throw new UnsupportedOperationException("allowSnapshot is not "
            + "supported for HttpFs on " + fs.getClass()
            + ". Please check your fs.defaultFS configuration");
      }
      return null;
    }
  }

  /**
   *  Executor that performs an disallowSnapshot operation.
   */
  @InterfaceAudience.Private
  public static class FSDisallowSnapshot implements
      FileSystemAccess.FileSystemExecutor<Void> {

    private Path path;

    /**
     * Creates a disallowSnapshot executor.

View on GitHub (pinned to 2add963021)

Solutions

  1. Set fs.defaultFS to the HDFS nameservice (e.g. hdfs://ns1 or hdfs://namenode:8020) in the HttpFS server configuration and restart HttpFS
  2. Verify which filesystem the server actually opened: a quick curl LISTSTATUS plus server log check, or confirm httpfs-site.xml is the loaded config
  3. If snapshots must work against HDFS, connect with WebHDFS (webhdfs://namenode:9870) directly instead of through an HttpFS proxy backed by another FS
  4. If the backing store is intentionally non-HDFS, stop calling snapshot operations against it

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, then: curl '.../webhdfs/v1/dir?op=ALLOWSNAPSHOT' returns 200 -->
Defensive patterns

Strategy: try-catch

Type guard

// server-side (custom executors): narrow before calling DFS-only APIs
static DistributedFileSystem asDfs(FileSystem fs) {
  return fs instanceof DistributedFileSystem ? (DistributedFileSystem) fs : null;
}

Try / catch

try {
  fs.allowSnapshot(path); // via webhdfs/HttpFS
} catch (IOException e) {
  if (e.getMessage() != null && e.getMessage().contains("not supported for HttpFs")) {
    // gateway's fs.defaultFS is not HDFS: fix server config or skip the op
    LOG.warn("HttpFS server not HDFS-backed; skipping allowSnapshot({})", path);
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Client sends op=ALLOWSNAPSHOT (fs.allowSnapshot(path) through webhdfs://) while the HttpFS server's fs.defaultFS resolves to file:///, s3a://, abfs://, viewfs://, or any non-HDFS filesystem.

Common situations: HttpFS deployed as a gateway in front of object storage; httpfs-site.xml (or the server environment) missing fs.defaultFS so the default local filesystem is used; test setups running HttpFS standalone with LocalFileSystem.

Related errors


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