apache/hadoop · error · IllegalArgumentException

Invalid argument : {}

Error message

Invalid argument : {}

What it means

dfsrouteradmin -setQuota walks every token after the mount path and accepts only the exact flags -nsQuota and -ssQuota (case-sensitive). Any other token reaches the else branch and throws 'Invalid argument : <token>'. This is pure client-side argument validation; no RPC is made.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/tools/federation/RouterAdmin.java:999

      if (parameters[i].equals("-nsQuota")) {
        i++;
        try {
          nsQuota = Long.parseLong(parameters[i]);
        } catch (Exception e) {
          throw new IllegalArgumentException(
              "Cannot parse nsQuota: " + parameters[i]);
        }
      } else if (parameters[i].equals("-ssQuota")) {
        i++;
        try {
          ssQuota = StringUtils.TraditionalBinaryPrefix
              .string2long(parameters[i]);
        } catch (Exception e) {
          throw new IllegalArgumentException(
              "Cannot parse ssQuota: " + parameters[i]);
        }
      } else {
        throw new IllegalArgumentException(
            "Invalid argument : " + parameters[i]);
      }

      i++;
    }

    if (nsQuota <= 0 || ssQuota <= 0) {
      throw new IllegalArgumentException(
          "Input quota value should be a positive number.");
    }

    if (nsQuota == HdfsConstants.QUOTA_DONT_SET &&
        ssQuota == HdfsConstants.QUOTA_DONT_SET) {
      throw new IllegalArgumentException(
          "Must specify at least one of -nsQuota and -ssQuota.");
    }

    return updateQuota(mount, nsQuota, ssQuota);

View on GitHub (pinned to 2add963021)

Solutions

  1. Use exactly -nsQuota and/or -ssQuota after the mount path, in that spelling
  2. For per-storage-type quotas use: hdfs dfsrouteradmin -setStorageTypeQuota <path> -storageType <type> <quota>
  3. Print the syntax first: hdfs dfsrouteradmin -help setQuota
  4. Remove any extra tokens (second paths, generic flags) from the command line

Example fix

# before
hdfs dfsrouteradmin -setQuota /mount -nsquota 100000
# after
hdfs dfsrouteradmin -setQuota /mount -nsQuota 100000
Defensive patterns

Strategy: validation

Validate before calling

# whitelist tokens after the mount path
case "$FLAG" in
  -nsQuota|-ssQuota) ;;
  *) echo "unsupported flag '$FLAG' for -setQuota" >&2; exit 2;;
esac

Prevention

When it happens

Trigger: -setQuota /mount -nsquota 5 (lowercase flag); -setQuota /mount -storageType DISK 100 (that flag belongs to -setStorageTypeQuota); a duplicated mount path; a stray option such as -v or --help appended to the command.

Common situations: Flag spelling mistakes and wrong-case flags; using storage-type quota syntax with -setQuota; leftover arguments from copy-pasted runbooks; scripts appending logging flags the subcommand does not support.

Related errors


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