apache/hadoop · error · HadoopIllegalArgumentException

Can not specify both '-n name' and '-x name' option.

Error message

Can not specify both '-n name' and '-x name' option.

What it means

Error "Can not specify both '-n name' and '-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:163

      "base64 encoding.\n" +
      "-x name: Remove the extended attribute.\n" +
      "<path>: The file or directory.\n";

    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) {

View on GitHub (pinned to 2add963021)

Solutions

  1. Use only one of '-n name' (value in hex/text) or '-x name' (remove xattr) per invocation.
  2. Split the operation into two setfattr calls if both are needed.

When it happens

Trigger: Thrown by setfattr when both -n name (set value) and -x name (remove) are specified together, which is mutually exclusive.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/8b457c3b38f807da. Report an issue: GitHub.