{"record":{"id":"465787cdbf49eee6","repo":"apache/hadoop","slug":"setpermission-operation-is-only-supported-on-hns-e","errorCode":null,"errorMessage":"SetPermission operation is only supported on HNS enabled Accounts.","messagePattern":"SetPermission operation is only supported on HNS enabled Accounts\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlobClient.java","lineNumber":1438,"sourceCode":"      final TracingContext tracingContext) throws AzureBlobFileSystemException {\n    throw new UnsupportedOperationException(\n        \"SetOwner operation is only supported on HNS enabled Accounts.\");\n  }\n\n  /**\n   * Set the permission of the file or directory.\n   * Not supported for HNS-Disabled Accounts.\n   * @param path on which permission has to be set.\n   * @param permission to be set.\n   * @param tracingContext for tracing the server calls.\n   * @return exception as this operation is not supported on Blob Endpoint.\n   * @throws UnsupportedOperationException always.\n   */\n  @Override\n  public AbfsRestOperation setPermission(final String path,\n      final String permission,\n      final TracingContext tracingContext) throws AzureBlobFileSystemException {\n    throw new UnsupportedOperationException(\n        \"SetPermission operation is only supported on HNS enabled Accounts.\");\n  }\n\n  /**\n   * Set the ACL of the file or directory.\n   * Not supported for HNS-Disabled Accounts.\n   * @param path on which ACL has to be set.\n   * @param aclSpecString to be set.\n   * @param eTag to specify conditional headers. Set only if etag matches.\n   * @param tracingContext for tracing the server calls.\n   * @return exception as this operation is not supported on Blob Endpoint.\n   * @throws UnsupportedOperationException always.\n   */\n  @Override\n  public AbfsRestOperation setAcl(final String path,\n      final String aclSpecString,\n      final String eTag,\n      final TracingContext tracingContext) throws AzureBlobFileSystemException {","sourceCodeStart":1420,"sourceCodeEnd":1456,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlobClient.java#L1420-L1456","documentation":"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.","triggerScenarios":"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.","commonSituations":"Distcp preserve-mode runs to non-HNS accounts; Hive/Spark setup scripts chmod-ing warehouse dirs; portable pipelines reusing HDFS hardening steps.","solutions":["Enable HNS on the account, or move this workload to an HNS-enabled account","Skip permission preservation in distcp (omit the 'p' preservation flags for permissions)","Remove chmod/setPermission calls from provisioning scripts that target non-HNS abfs:// URIs"],"exampleFix":"// before\nfs.setPermission(path, FsPermission.valueOf(\"rw-r-----\"));\n\n// after\nif (isHnsAccount(fs)) {\n  fs.setPermission(path, FsPermission.valueOf(\"rw-r-----\"));\n}","handlingStrategy":"validation","validationCode":"if (isHnsAccount(fs)) {\n  fs.setPermission(path, FsPermission.valueOf(\"rw-r-----\"));\n}","typeGuard":"private static boolean supportsPosixPermissions(FileSystem fs) {\n  return !(fs instanceof AzureBlobFileSystem) // native POSIX fs\n      || fs.getConf().getBoolean(\"fs.azure.account.hns.enabled\", false);\n}","tryCatchPattern":"try {\n  fs.setPermission(path, perm);\n} catch (UnsupportedOperationException e) {\n  // non-HNS ABFS: rely on Azure RBAC instead of POSIX bits\n}","preventionTips":["Skip chmod-style provisioning on non-HNS abfs:// URIs","Use distcp without permission-preservation flags against flat-namespace accounts","Model access with Azure RBAC/SAS on non-HNS accounts"],"tags":["azure","abfs","unsupported-operation","hns","permissions"],"backgroundTag":"unsupported-operation","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}