apache/hadoop · error · UnsupportedOperationException

SetPermission operation is only supported on HNS enabled Acc

Error message

SetPermission operation is only supported on HNS enabled Accounts.

What it means

AbfsBlobClient (the non-HNS client) implements setPermission as a stub that always throws UnsupportedOperationException('SetPermission operation is only supported on HNS enabled Accounts.'). POSIX-style permission bits are a hierarchical-namespace feature; on flat-namespace accounts access is governed by Azure RBAC / SAS / container-level ACLs, so there is nothing the driver could send.

Source

Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlobClient.java:1438

      final TracingContext tracingContext) throws AzureBlobFileSystemException {
    throw new UnsupportedOperationException(
        "SetOwner operation is only supported on HNS enabled Accounts.");
  }

  /**
   * Set the permission of the file or directory.
   * Not supported for HNS-Disabled Accounts.
   * @param path on which permission has to be set.
   * @param permission to be set.
   * @param tracingContext for tracing the server calls.
   * @return exception as this operation is not supported on Blob Endpoint.
   * @throws UnsupportedOperationException always.
   */
  @Override
  public AbfsRestOperation setPermission(final String path,
      final String permission,
      final TracingContext tracingContext) throws AzureBlobFileSystemException {
    throw new UnsupportedOperationException(
        "SetPermission operation is only supported on HNS enabled Accounts.");
  }

  /**
   * Set the ACL of the file or directory.
   * Not supported for HNS-Disabled Accounts.
   * @param path on which ACL has to be set.
   * @param aclSpecString to be set.
   * @param eTag to specify conditional headers. Set only if etag matches.
   * @param tracingContext for tracing the server calls.
   * @return exception as this operation is not supported on Blob Endpoint.
   * @throws UnsupportedOperationException always.
   */
  @Override
  public AbfsRestOperation setAcl(final String path,
      final String aclSpecString,
      final String eTag,
      final TracingContext tracingContext) throws AzureBlobFileSystemException {

View on GitHub (pinned to 2add963021)

Solutions

  1. Enable HNS on the account, or move this workload to an HNS-enabled account
  2. Skip permission preservation in distcp (omit the 'p' preservation flags for permissions)
  3. Remove chmod/setPermission calls from provisioning scripts that target non-HNS abfs:// URIs

Example fix

// before
fs.setPermission(path, FsPermission.valueOf("rw-r-----"));

// after
if (isHnsAccount(fs)) {
  fs.setPermission(path, FsPermission.valueOf("rw-r-----"));
}
Defensive patterns

Strategy: validation

Validate before calling

if (isHnsAccount(fs)) {
  fs.setPermission(path, FsPermission.valueOf("rw-r-----"));
}

Type guard

private static boolean supportsPosixPermissions(FileSystem fs) {
  return !(fs instanceof AzureBlobFileSystem) // native POSIX fs
      || fs.getConf().getBoolean("fs.azure.account.hns.enabled", false);
}

Try / catch

try {
  fs.setPermission(path, perm);
} catch (UnsupportedOperationException e) {
  // non-HNS ABFS: rely on Azure RBAC instead of POSIX bits
}

Prevention

When it happens

Trigger: Calling fs.setPermission(path, FsPermission) on an abfs:// path backed by an account without hierarchical namespace — commonly distcp -p or UMask-driven provisioning code that preserves HDFS permissions.

Common situations: Distcp preserve-mode runs to non-HNS accounts; Hive/Spark setup scripts chmod-ing warehouse dirs; portable pipelines reusing HDFS hardening steps.

Related errors


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