apache/hadoop · error · HadoopIllegalArgumentException
Must specify '-n name' or '-x name' option.
Error message
Must specify '-n name' or '-x name' option.
What it means
Error "Must specify '-n name' or '-x name' option." thrown in apache/hadoop.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/XAttrCommands.java:167
private String name = null;
private byte[] value = null;
private String xname = null;
@Override
protected void processOptions(LinkedList<String> args) throws IOException {
name = StringUtils.popOptionWithArgument("-n", args);
String v = StringUtils.popOptionWithArgument("-v", args);
if (v != null) {
value = XAttrCodec.decodeValue(v);
}
xname = StringUtils.popOptionWithArgument("-x", args);
if (name != null && xname != null) {
throw new HadoopIllegalArgumentException(
"Can not specify both '-n name' and '-x name' option.");
}
if (name == null && xname == null) {
throw new HadoopIllegalArgumentException(
"Must specify '-n name' or '-x name' 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 {
if (name != null) {
item.fs.setXAttr(item.path, name, value);
} else if (xname != null) {
item.fs.removeXAttr(item.path, xname);
}View on GitHub (pinned to 2add963021)
Solutions
- Pass '-n name' to set an xattr or '-x name' to remove one.
- Check the setfattr command usage and add the required option.
When it happens
Trigger: Thrown by setfattr when neither -n name nor -x name is given, so no xattr operation is selected.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/7158f53e3a9c9b0f.
Report an issue: GitHub.