{"record":{"id":"8b457c3b38f807da","repo":"apache/hadoop","slug":"can-not-specify-both-n-name-and-x-name-optio","errorCode":null,"errorMessage":"Can not specify both '-n name' and '-x name' option.","messagePattern":"Can not specify both '-n name' and '-x name' option\\.","errorType":"exception","errorClass":"HadoopIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/XAttrCommands.java","lineNumber":163,"sourceCode":"      \"base64 encoding.\\n\" +\n      \"-x name: Remove the extended attribute.\\n\" +\n      \"<path>: The file or directory.\\n\";\n\n    private String name = null;\n    private byte[] value = null;\n    private String xname = null;\n\n    @Override\n    protected void processOptions(LinkedList<String> args) throws IOException {\n      name = StringUtils.popOptionWithArgument(\"-n\", args);\n      String v = StringUtils.popOptionWithArgument(\"-v\", args);\n      if (v != null) {\n        value = XAttrCodec.decodeValue(v);\n      }\n      xname = StringUtils.popOptionWithArgument(\"-x\", args);\n\n      if (name != null && xname != null) {\n        throw new HadoopIllegalArgumentException(\n            \"Can not specify both '-n name' and '-x name' option.\");\n      }\n      if (name == null && xname == null) {\n        throw new HadoopIllegalArgumentException(\n            \"Must specify '-n name' or '-x name' option.\");\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\n    @Override\n    protected void processPath(PathData item) throws IOException {\n      if (name != null) {","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/XAttrCommands.java#L145-L181","documentation":"Error \"Can not specify both '-n name' and '-x name' option.\" thrown in apache/hadoop.","triggerScenarios":"Thrown by setfattr when both -n name (set value) and -x name (remove) are specified together, which is mutually exclusive.","commonSituations":"See trigger scenarios.","solutions":["Use only one of '-n name' (value in hex/text) or '-x name' (remove xattr) per invocation.","Split the operation into two setfattr calls if both are needed."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}