apache/hadoop · error · HadoopIllegalArgumentException

Too many arguments

Error message

Too many arguments

What it means

Getfacl.processOptions throws HadoopIllegalArgumentException('Too many arguments') when more than one path operand remains after option parsing. getfacl accepts exactly one path per invocation; recursion over a tree is expressed with -R, not with multiple paths.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java:73

  public static class GetfaclCommand extends FsCommand {
    public static String NAME = GET_FACL;
    public static String USAGE = "[-R] <path>";
    public static String DESCRIPTION = "Displays the Access Control Lists"
        + " (ACLs) of files and directories. If a directory has a default ACL,"
        + " then getfacl also displays the default ACL.\n"
        + "  -R: List the ACLs of all files and directories recursively.\n"
        + "  <path>: File or directory to list.\n";

    @Override
    protected void processOptions(LinkedList<String> args) throws IOException {
      CommandFormat cf = new CommandFormat(0, Integer.MAX_VALUE, "R");
      cf.parse(args);
      setRecursive(cf.getOpt("R"));
      if (args.isEmpty()) {
        throw new HadoopIllegalArgumentException("<path> is missing");
      }
      if (args.size() > 1) {
        throw new HadoopIllegalArgumentException("Too many arguments");
      }
    }

    @Override
    protected void processPath(PathData item) throws IOException {
      out.println("# file: " + item);
      out.println("# owner: " + item.stat.getOwner());
      out.println("# group: " + item.stat.getGroup());
      FsPermission perm = item.stat.getPermission();
      if (perm.getStickyBit()) {
        out.println("# flags: --" +
          (perm.getOtherAction().implies(FsAction.EXECUTE) ? "t" : "T"));
      }

      final AclStatus aclStatus;
      final List<AclEntry> entries;
      if (item.stat.hasAcl()) {
        aclStatus = item.fs.getAclStatus(item.path);

View on GitHub (pinned to 2add963021)

Solutions

  1. Pass a single path and add -R when recursion is intended: hadoop fs -getfacl -R /dir.
  2. Loop when you truly need separate non-recursive calls: for p in /a /b; do hadoop fs -getfacl "$p"; done.

Example fix

# before
hadoop fs -getfacl /data/*

# after
hadoop fs -getfacl -R /data
Defensive patterns

Strategy: validation

Validate before calling

if [ $# -gt 1 ]; then echo "one path only; use -R for recursion" >&2; exit 2; fi
hadoop fs -getfacl "$1"

Prevention

When it happens

Trigger: 'hadoop fs -getfacl /a /b'; an unquoted glob ('hadoop fs -getfacl /dir/*') that the local shell expands into multiple arguments before Hadoop parses them.

Common situations: Users intending recursive listing who pass several files or an expanded glob instead of -R; scripts looping constructs that accidentally pass a list as one command line.

Related errors


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