{"record":{"id":"46e756b040fdbef2","repo":"apache/hadoop","slug":"this-operation-is-only-valid-for-storage-accounts","errorCode":null,"errorMessage":"This operation is only valid for storage accounts with the hierarchical namespace enabled.","messagePattern":"This operation is only valid for storage accounts with the hierarchical namespace enabled\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java","lineNumber":1477,"sourceCode":"    for (int i = 0; i < base64EncodedToken.length(); i++) {\n      char current = base64EncodedToken.charAt(i);\n      if (CHAR_FORWARD_SLASH == current) {\n        current = CHAR_UNDERSCORE;\n      } else if (CHAR_PLUS == current) {\n        current = CHAR_STAR;\n      } else if (CHAR_EQUALS == current) {\n        current = CHAR_HYPHEN;\n      }\n      encodedTokenBuilder.append(current);\n    }\n\n    return encodedTokenBuilder.toString();\n  }\n\n  public void setOwner(final Path path, final String owner, final String group,\n      TracingContext tracingContext) throws AzureBlobFileSystemException {\n    if (!getIsNamespaceEnabled(tracingContext)) {\n      throw new UnsupportedOperationException(\n          \"This operation is only valid for storage accounts with the hierarchical namespace enabled.\");\n    }\n\n    try (AbfsPerfInfo perfInfo = startTracking(\"setOwner\", \"setOwner\")) {\n\n      LOG.debug(\n              \"setOwner filesystem: {} path: {} owner: {} group: {}\",\n              getClient().getFileSystem(),\n              path,\n              owner,\n              group);\n\n      final String transformedOwner = identityTransformer.transformUserOrGroupForSetRequest(owner);\n      final String transformedGroup = identityTransformer.transformUserOrGroupForSetRequest(group);\n\n      final AbfsRestOperation op = getClient().setOwner(getRelativePath(path),\n              transformedOwner,\n              transformedGroup,","sourceCodeStart":1459,"sourceCodeEnd":1495,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java#L1459-L1495","documentation":"ABFS exposes POSIX ownership only on storage accounts with the hierarchical namespace (HNS/Data Lake Gen2) enabled. setOwner checks getIsNamespaceEnabled() client-side before any REST call and throws UnsupportedOperationException on flat blob accounts - the request never reaches the service.","triggerScenarios":"Calling fs.setOwner(path, owner, group) (hadoop fs -chown) on an ABFS mount backed by a non-HNS storage account; also programmatic owner changes from Ranger/privilege sync tooling.","commonSituations":"Storage account created without the 'Hierarchical namespace' option; wasb workflows migrated to abfs expecting POSIX semantics; chown steps in provisioning scripts run against blob accounts.","solutions":["Enable Hierarchical Namespace on the account (Azure Portal > storage account > Data Lake Gen2) or move data to an HNS-enabled account, then re-mount.","Skip the chown step for flat accounts (guard it behind an HNS capability check).","Verify with 'az storage account show --name <acct> --query isHnsEnabled'.","Ensure fs.defaultFS points at abfs(s)://container@account.dfs.core.windows.net of the HNS account, not at a blob-endpoint alias."],"exampleFix":"# before\nhadoop fs -chown newowner:newgroup abfs://c@flatacct.dfs.core.windows.net/data\n\n# after - either enable HNS on the account, or skip chown on non-HNS mounts","handlingStrategy":"try-catch","validationCode":"if (fs instanceof AzureBlobFileSystem\n    && !((AzureBlobFileSystem) fs).getAbfsStore().getIsNamespaceEnabled(null)) {\n  // skip setOwner - account has no hierarchical namespace\n}","typeGuard":null,"tryCatchPattern":"try { fs.setOwner(path, owner, group); } catch (UnsupportedOperationException e) {\n  if (e.getMessage().contains(\"hierarchical namespace\")) { /* account is not HNS: skip ownership ops */ }\n}","preventionTips":["Check az storage account show --query isHnsEnabled before scripting chown.","Gate POSIX metadata operations behind an HNS capability probe.","Create Gen2 (HNS) accounts wherever POSIX semantics are expected."],"tags":["azure","abfs","permissions","owner","hierarchical-namespace","hns"],"backgroundTag":"hierarchical-namespace-required","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}