apache/hadoop · error · HadoopIllegalArgumentException

Missing arguments: <acl_spec> <path>

Error message

Missing arguments: <acl_spec> <path>

What it means

Setfacl.processOptions throws HadoopIllegalArgumentException('Missing arguments: <acl_spec> <path>') when a modify or replace flag (-m, -x, or --set) was given but the remaining argument list is empty. Both the ACL spec and the path operand are mandatory for these modes.

Source

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

      boolean bothRemoveOptions = cf.getOpt("b") && cf.getOpt("k");
      boolean bothModifyOptions = cf.getOpt("m") && cf.getOpt("x");
      boolean oneRemoveOption = cf.getOpt("b") || cf.getOpt("k");
      boolean oneModifyOption = cf.getOpt("m") || cf.getOpt("x");
      boolean setOption = cf.getOpt("-set");
      boolean hasExpectedOptions = cf.getOpt("b") || cf.getOpt("k") ||
          cf.getOpt("m") || cf.getOpt("x") || cf.getOpt("-set");

      if ((bothRemoveOptions || bothModifyOptions)
          || (oneRemoveOption && oneModifyOption)
          || (setOption && (oneRemoveOption || oneModifyOption))) {
        throw new HadoopIllegalArgumentException(
            "Specified flags contains both remove and modify flags");
      }

      // Only -m, -x and --set expects <acl_spec>
      if (oneModifyOption || setOption) {
        if (args.isEmpty()) {
          throw new HadoopIllegalArgumentException(
              "Missing arguments: <acl_spec> <path>");
        }
        if (args.size() < 2) {
          throw new HadoopIllegalArgumentException(
              "Missing either <acl_spec> or <path>");
        }
        aclEntries = AclEntry.parseAclSpec(args.removeFirst(), !cf.getOpt("x"));
        if (aclEntries.isEmpty()) {
          throw new HadoopIllegalArgumentException(
              "Missing <acl_spec> entry");
        }
      }

      if (args.isEmpty()) {
        throw new HadoopIllegalArgumentException("<path> is missing");
      }
      if (args.size() > 1) {
        throw new HadoopIllegalArgumentException("Too many arguments");

View on GitHub (pinned to 2add963021)

Solutions

  1. Provide both operands: hadoop fs -setfacl -m user:tom:r-- /user/tom/file.
  2. Validate required variables before building the command: [ -n "$SPEC" ] && [ -n "$P" ] || exit 1.

Example fix

# before
hadoop fs -setfacl -m $SPEC /data   # $SPEC unset -> only '-m' remains -> throws

# after
SPEC='user:tom:r--'
hadoop fs -setfacl -m "$SPEC" /data
Defensive patterns

Strategy: validation

Validate before calling

[ -n "$SPEC" ] && [ -n "$TARGET" ] || { echo "setfacl needs <acl_spec> and <path>" >&2; exit 2; }
hadoop fs -setfacl -m "$SPEC" "$TARGET"

Prevention

When it happens

Trigger: 'hadoop fs -setfacl -m' or 'hadoop fs -setfacl --set' with nothing after the flag — args is empty after option parsing.

Common situations: A script's SPEC or PATH variable is unset/empty so only the mode flag survives on the command line; command assembly code that conditionally appends arguments and appends none.

Related errors


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