{"record":{"id":"d3b892649ad0d610","repo":"apache/hadoop","slug":"doesn-t-support-removeacl-d3b892","errorCode":null,"errorMessage":"{} doesn't support removeAcl","messagePattern":"(.+?) doesn't support removeAcl","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java","lineNumber":3196,"sourceCode":"  public void removeDefaultAcl(Path path)\n      throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()\n        + \" doesn't support removeDefaultAcl\");\n  }\n\n  /**\n   * Removes all but the base ACL entries of files and directories.  The entries\n   * for user, group, and others are retained for compatibility with permission\n   * bits.\n   *\n   * @param path Path to modify\n   * @throws IOException if an ACL could not be removed\n   * @throws UnsupportedOperationException if the operation is unsupported\n   *         (default outcome).\n   */\n  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  }","sourceCodeStart":3178,"sourceCodeEnd":3214,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java#L3178-L3214","documentation":"FileSystem.removeAcl(Path) is optional; the base class throws UnsupportedOperationException with getClass().getSimpleName() + \" doesn't support removeAcl\". It strips a file back to base ACL entries (owner/group/other bits); implemented only by HDFS-family clients, ABFS, and pass-through wrappers. Local filesystem and S3A/GCS-style connectors inherit the throwing default.","triggerScenarios":"Calling fs.removeAcl(path) — typically 'reset to plain permissions' — on a non-supporting store; permission-normalization sweeps that iterate many paths across mixed schemes and hit one on file:// or s3a://.","commonSituations":"Bulk permission resets after audits; data prepared on HDFS then replicated to an object store where the reset step still runs.","solutions":["Probe fs.hasPathCapability(path, CommonPathCapabilities.FS_ACLS) before resetting","As the fallback, call setPermission(path, stat.getPermission()) — applying the base bits is exactly what removeAcl achieves on ACL stores","Restrict ACL-reset jobs to hdfs:// paths","Catch UnsupportedOperationException and count it as a no-op success with a log line"],"exampleFix":"// before\nfs.removeAcl(path); // throws on stores without ACL support\n\n// after\nif (fs.hasPathCapability(path, CommonPathCapabilities.FS_ACLS)) {\n  fs.removeAcl(path);\n} else {\n  FileStatus st = fs.getFileStatus(path);\n  fs.setPermission(path, st.getPermission()); // equivalent end state\n}","handlingStrategy":"try-catch","validationCode":"if (fs.hasPathCapability(path, CommonPathCapabilities.FS_ACLS)) {\n  fs.removeAcl(path);\n} else {\n  FileStatus st = fs.getFileStatus(path);\n  fs.setPermission(path, st.getPermission()); // reapply base bits\n}","typeGuard":"static boolean supportsFullAclReset(FileSystem fs) {\n  return fs instanceof DistributedFileSystem\n      || fs instanceof WebHdfsFileSystem;\n}","tryCatchPattern":"try {\n  fs.removeAcl(path);\n} catch (UnsupportedOperationException e) {\n  // equivalent fallback: reapply the base permission bits\n  fs.setPermission(path, fs.getFileStatus(path).getPermission());\n}","preventionTips":["Implement ACL resets with a setPermission fallback so the same code runs everywhere","Run permission-normalization sweeps per scheme with capability checks up front","Verify with getAclStatus().getEntries().isEmpty() where supported"],"tags":["hadoop","filesystem","hdfs","acl","permissions","unsupportedoperationexception"],"backgroundTag":"filesystem-acl-unsupported","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}