{"record":{"id":"1389c9b54806e42f","repo":"apache/hadoop","slug":"expected-one-of-b-k-m-x-or-set-options","errorCode":null,"errorMessage":"Expected one of -b, -k, -m, -x or --set options","messagePattern":"Expected one of -b, -k, -m, -x or --set options","errorType":"exception","errorClass":"HadoopIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java","lineNumber":233,"sourceCode":"          throw new HadoopIllegalArgumentException(\n              \"Missing either <acl_spec> or <path>\");\n        }\n        aclEntries = AclEntry.parseAclSpec(args.removeFirst(), !cf.getOpt(\"x\"));\n        if (aclEntries.isEmpty()) {\n          throw new HadoopIllegalArgumentException(\n              \"Missing <acl_spec> entry\");\n        }\n      }\n\n      if (args.isEmpty()) {\n        throw new HadoopIllegalArgumentException(\"<path> is missing\");\n      }\n      if (args.size() > 1) {\n        throw new HadoopIllegalArgumentException(\"Too many arguments\");\n      }\n\n      if (!hasExpectedOptions) {\n        throw new HadoopIllegalArgumentException(\n            \"Expected one of -b, -k, -m, -x or --set options\");\n      }\n      // In recursive mode, save a separate list of just the access ACL entries.\n      // Only directories may have a default ACL.  When a recursive operation\n      // encounters a file under the specified path, it must pass only the\n      // access ACL entries.\n      if (isRecursive() && (oneModifyOption || setOption)) {\n        accessAclEntries = Lists.newArrayList();\n        for (AclEntry entry: aclEntries) {\n          if (entry.getScope() == AclEntryScope.ACCESS) {\n            accessAclEntries.add(entry);\n          }\n        }\n      }\n    }\n\n    @Override\n    protected void processPath(PathData item) throws IOException {","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java#L215-L251","documentation":"Setfacl.processOptions throws HadoopIllegalArgumentException('Expected one of -b, -k, -m, -x or --set options') when no operation flag at all was supplied. setfacl never operates without a mode: it does not display ACLs (that is getfacl) and has no default action.","triggerScenarios":"'hadoop fs -setfacl /data' — a lone path with none of -b, -k, -m, -x, or --set present, so hasExpectedOptions at AclCommands.java:233 is false.","commonSituations":"Users assuming setfacl without flags prints or refreshes ACLs; commands built programmatically where the mode flag variable was dropped; confusion with the Linux setfacl habit of always passing a flag (the Hadoop command enforces the same but the error text differs).","solutions":["Add the intended mode flag: -b (remove all ACLs), -k (remove default ACL), -m (modify entries), -x (remove specific entries), or --set (replace the full ACL).","If the goal was to view ACLs, use hadoop fs -getfacl instead."],"exampleFix":"# before\nhadoop fs -setfacl /data\n\n# after\nhadoop fs -setfacl -m user:tom:r-- /data   # or -b / -k / -x / --set","handlingStrategy":"validation","validationCode":"case \"$MODE\" in\n  -b|-k) hadoop fs -setfacl \"$MODE\" \"$TARGET\";;\n  -m|-x|--set) hadoop fs -setfacl \"$MODE\" \"$SPEC\" \"$TARGET\";;\n  *) echo \"setfacl requires one of -b -k -m -x --set\" >&2; exit 2;;\nesac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick one of -b, -k, -m, -x, --set every time; setfacl has no default action.","Use getfacl to display ACLs."],"tags":["cli","setfacl","acl","missing-flag","hadoop"],"backgroundTag":"missing-cli-flag","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}