apache/hadoop · error · HadoopIllegalArgumentException
Must specify '-n name' or '-d' option.
Error message
Must specify '-n name' or '-d' option.
What it means
Error "Must specify '-n name' or '-d' option." thrown in apache/hadoop.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/XAttrCommands.java:90
name = StringUtils.popOptionWithArgument("-n", args);
String en = StringUtils.popOptionWithArgument("-e", args);
if (en != null) {
try {
encoding = XAttrCodec.valueOf(StringUtils.toUpperCase(en));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException(
"Invalid/unsupported encoding option specified: " + en);
}
Preconditions.checkArgument(encoding != null,
"Invalid/unsupported encoding option specified: " + en);
}
boolean r = StringUtils.popOption("-R", args);
setRecursive(r);
dump = StringUtils.popOption("-d", args);
if (!dump && name == null) {
throw new HadoopIllegalArgumentException(
"Must specify '-n name' or '-d' option.");
}
if (args.isEmpty()) {
throw new HadoopIllegalArgumentException("<path> is missing.");
}
if (args.size() > 1) {
throw new HadoopIllegalArgumentException("Too many arguments.");
}
}
@Override
protected void processPath(PathData item) throws IOException {
out.println("# file: " + item);
if (dump) {
Map<String, byte[]> xattrs = item.fs.getXAttrs(item.path);
if (xattrs != null) {
Iterator<Entry<String, byte[]>> iter = xattrs.entrySet().iterator();View on GitHub (pinned to 2add963021)
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.
When it happens
Trigger: Thrown by getfattr when neither the -n name nor the -d (dump all) option is supplied.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/00f247e236754b8c.
Report an issue: GitHub.