{"record":{"id":"05a407785592b233","repo":"apache/hadoop","slug":"doesn-t-support-setacl-05a407","errorCode":null,"errorMessage":"{} doesn't support setAcl","messagePattern":"(.+?) doesn't support setAcl","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java","lineNumber":3212,"sourceCode":"  public void removeAcl(Path path)\n      throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()\n        + \" doesn't support removeAcl\");\n  }\n\n  /**\n   * Fully replaces ACL of files and directories, discarding all existing\n   * entries.\n   *\n   * @param path Path to modify\n   * @param aclSpec List describing modifications, which must include entries\n   *   for user, group, and others for compatibility with permission bits.\n   * @throws IOException if an ACL could not be modified\n   * @throws UnsupportedOperationException if the operation is unsupported\n   *         (default outcome).\n   */\n  public void setAcl(Path path, List<AclEntry> aclSpec) throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()\n        + \" doesn't support setAcl\");\n  }\n\n  /**\n   * Gets the ACL of a file or directory.\n   *\n   * @param path Path to get\n   * @return AclStatus describing the ACL of the file or directory\n   * @throws IOException if an ACL could not be read\n   * @throws UnsupportedOperationException if the operation is unsupported\n   *         (default outcome).\n   */\n  public AclStatus getAclStatus(Path path) throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()\n        + \" doesn't support getAclStatus\");\n  }\n\n  /**","sourceCodeStart":3194,"sourceCodeEnd":3230,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java#L3194-L3230","documentation":"FileSystem.setAcl(Path, List<AclEntry>) is optional; the base class throws UnsupportedOperationException with getClass().getSimpleName() + \" doesn't support setAcl\". It fully replaces a file's ACL (must include user/group/other entries). Implemented by DistributedFileSystem, WebHdfsFileSystem, HttpFSFileSystem, ABFS and pass-throughs; not by RawLocalFileSystem or S3A/GCS.","triggerScenarios":"Calling fs.setAcl(path, fullAclSpec) on file://, s3a://, gs://, har:// or a custom FileSystem without the override; 'apply this ACL template' provisioning steps in dataset-creation pipelines.","commonSituations":"Data-lake provisioning that stamps a standard ACL template on new datasets and is also run against staging/test buckets or local directories; distcp -p preserving ACLs onto a non-ACL target.","solutions":["Probe fs.hasPathCapability(path, CommonPathCapabilities.FS_ACLS) before applying the template","Fall back to setPermission/setOwner for the bits-only portion of the template","distcp: omit ACL preservation (-p without acl) for non-HDFS destinations","Catch UnsupportedOperationException and record the dataset as ACL-less in your permission catalog"],"exampleFix":"// before\nfs.setAcl(path, aclTemplate); // throws on LocalFileSystem/S3A\n\n// after\nif (fs.hasPathCapability(path, CommonPathCapabilities.FS_ACLS)) {\n  fs.setAcl(path, aclTemplate);\n} else {\n  fs.setOwner(path, templateOwner, templateGroup);\n  fs.setPermission(path, templatePermission);\n}","handlingStrategy":"try-catch","validationCode":"if (fs.hasPathCapability(path, CommonPathCapabilities.FS_ACLS)) {\n  fs.setAcl(path, aclTemplate);\n} else {\n  fs.setOwner(path, tplOwner, tplGroup);\n  fs.setPermission(path, tplPermission);\n}","typeGuard":"static boolean supportsSetAcl(FileSystem fs) {\n  return fs instanceof DistributedFileSystem\n      || fs instanceof WebHdfsFileSystem;\n}","tryCatchPattern":"try {\n  fs.setAcl(path, aclTemplate);\n} catch (UnsupportedOperationException e) {\n  // degrade to owner/group + permission bits\n}","preventionTips":["Make ACL templates carry a bits-only fallback variant for non-ACL stores","Validate AclEntry lists include user/group/other entries before calling (a different failure on HDFS otherwise)","distcp: omit ACL preservation for non-HDFS targets"],"tags":["hadoop","filesystem","hdfs","acl","permissions","unsupportedoperationexception","provisioning"],"backgroundTag":"filesystem-acl-unsupported","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}