{"record":{"id":"00f247e236754b8c","repo":"apache/hadoop","slug":"must-specify-n-name-or-d-option","errorCode":null,"errorMessage":"Must specify '-n name' or '-d' option.","messagePattern":"Must specify '-n name' or '-d' 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":90,"sourceCode":"      name = StringUtils.popOptionWithArgument(\"-n\", args);\n      String en = StringUtils.popOptionWithArgument(\"-e\", args);\n      if (en != null) {\n        try {\n          encoding = XAttrCodec.valueOf(StringUtils.toUpperCase(en));\n        } catch (IllegalArgumentException e) {\n          throw new IllegalArgumentException(\n              \"Invalid/unsupported encoding option specified: \" + en);\n        }\n        Preconditions.checkArgument(encoding != null,\n            \"Invalid/unsupported encoding option specified: \" + en);\n      }\n\n      boolean r = StringUtils.popOption(\"-R\", args);\n      setRecursive(r);\n      dump = StringUtils.popOption(\"-d\", args);\n\n      if (!dump && name == null) {\n        throw new HadoopIllegalArgumentException(\n            \"Must specify '-n name' or '-d' 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      out.println(\"# file: \" + item);\n      if (dump) {\n        Map<String, byte[]> xattrs = item.fs.getXAttrs(item.path);\n        if (xattrs != null) {\n          Iterator<Entry<String, byte[]>> iter = xattrs.entrySet().iterator();","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/XAttrCommands.java#L72-L108","documentation":"Error \"Must specify '-n name' or '-d' option.\" thrown in apache/hadoop.","triggerScenarios":"Thrown by getfattr when neither the -n name nor the -d (dump all) option is supplied.","commonSituations":"See trigger scenarios.","solutions":["Pass either '-n name' to read one xattr or '-d' to dump all xattrs.","Check the getfattr command usage and add the required option."],"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"}