apache/hadoop · error · UnsupportedOperationException

{} doesn't support removeDefaultAcl

Error message

{} doesn't support removeDefaultAcl

What it means

FileSystem.removeDefaultAcl(Path) is optional; the base class throws UnsupportedOperationException with getClass().getSimpleName() + " doesn't support removeDefaultAcl". Default ACLs (inherited by children) are an HDFS concept; only the HDFS-family clients, ABFS, and pass-through wrappers implement the operation. Local filesystem and most object-store connectors throw.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java:3180

   *         (default outcome).
   */
  public void removeAclEntries(Path path, List<AclEntry> aclSpec)
      throws IOException {
    throw new UnsupportedOperationException(getClass().getSimpleName()
        + " doesn't support removeAclEntries");
  }

  /**
   * Removes all default ACL entries from files and directories.
   *
   * @param path Path to modify
   * @throws IOException if an ACL could not be modified
   * @throws UnsupportedOperationException if the operation is unsupported
   *         (default outcome).
   */
  public void removeDefaultAcl(Path path)
      throws IOException {
    throw new UnsupportedOperationException(getClass().getSimpleName()
        + " doesn't support removeDefaultAcl");
  }

  /**
   * Removes all but the base ACL entries of files and directories.  The entries
   * for user, group, and others are retained for compatibility with permission
   * bits.
   *
   * @param path Path to modify
   * @throws IOException if an ACL could not be removed
   * @throws UnsupportedOperationException if the operation is unsupported
   *         (default outcome).
   */
  public void removeAcl(Path path)
      throws IOException {
    throw new UnsupportedOperationException(getClass().getSimpleName()
        + " doesn't support removeAcl");
  }

View on GitHub (pinned to 2add963021)

Solutions

  1. Probe fs.hasPathCapability(path, CommonPathCapabilities.FS_ACLS) first
  2. Scope inheritance-management scripts to hdfs:// paths only
  3. Catch UnsupportedOperationException and continue — no default ACLs can exist on such stores
  4. For object stores, manage 'inheritance' via your own manifest of per-prefix permissions

Example fix

// before
fs.removeDefaultAcl(dir); // throws on LocalFileSystem

// after
try {
  fs.removeDefaultAcl(dir);
} catch (UnsupportedOperationException e) {
  LOG.info("No default-ACL support on {}: nothing to remove", fs.getUri());
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (fs.hasPathCapability(dir, CommonPathCapabilities.FS_ACLS)) {
  fs.removeDefaultAcl(dir);
}

Type guard

static boolean supportsDefaultAcls(FileSystem fs) {
  return fs instanceof DistributedFileSystem
      || fs instanceof WebHdfsFileSystem;
}

Try / catch

try {
  fs.removeDefaultAcl(dir);
} catch (UnsupportedOperationException e) {
  // store cannot have default ACLs: nothing to do
}

Prevention

When it happens

Trigger: Calling fs.removeDefaultAcl(path) on file://, s3a://, gs://, har:// or a custom FileSystem without the override; scripts that strip inheritance ('stop inheriting these defaults') before restructuring a directory tree.

Common situations: Directory-inheritance management run against the wrong scheme; the same admin script applied uniformly across a mixed HDFS + object-store data lake.

Related errors


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