apache/hadoop · error · HadoopIllegalArgumentException
Missing either <acl_spec> or <path>
Error message
Missing either <acl_spec> or <path>
What it means
Setfacl.processOptions throws HadoopIllegalArgumentException('Missing either <acl_spec> or <path>') when a modify/replace flag (-m, -x, --set) was given and exactly one argument remains after option parsing — two operands (spec, then path) are required, only one was supplied.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java:215
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");
}
if (!hasExpectedOptions) {
throw new HadoopIllegalArgumentException(View on GitHub (pinned to 2add963021)
Solutions
- Supply both operands in order: hadoop fs -setfacl -m user:tom:r-- /data.
- In scripts, assert argument count before invoking: require non-empty SPEC and non-empty PATH.
Example fix
# before hadoop fs -setfacl -m user:tom:r-- # after hadoop fs -setfacl -m user:tom:r-- /data
Defensive patterns
Strategy: validation
Validate before calling
[ $# -eq 2 ] || { echo "usage: setfacl -m|-x|--set <acl_spec> <path>" >&2; exit 2; }
hadoop fs -setfacl -m "$1" "$2" Prevention
- Mentally fix the operand order: spec first, path last, both required.
- Quote the spec so colons and commas survive the shell.
When it happens
Trigger: 'hadoop fs -setfacl -m user:tom:r--' (spec given, path forgotten) or 'hadoop fs -setfacl --set /data' (path given, spec forgotten) — either way args.size() < 2 at AclCommands.java:215.
Common situations: Forgetting the trailing path operand; shell quoting mistakes that merge or drop an argument; scripts where one of the two variables expands to nothing.
Related errors
- Missing arguments: <acl_spec> <path>
- <path> is missing
- Specified flags contains both remove and modify flags
- Missing <acl_spec> entry
- Expected one of -b, -k, -m, -x or --set options
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/4ecaf6983d46ddc7.
Report an issue: GitHub.