apache/hadoop · error · IllegalArgumentException

Must specify at least one of -nsQuota and -ssQuota.

Error message

Must specify at least one of -nsQuota and -ssQuota.

What it means

setQuota requires at least one of -nsQuota / -ssQuota. If neither flag is given, both values stay at the DONT_SET default (Long.MAX_VALUE) and the command aborts with this IllegalArgumentException instead of issuing a no-op update. It is the final client-side guard before updateQuota sends the request to the Router.

Source

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

          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);
  }

  /**
   * Set storage type quota for a mount table entry.
   *
   * @param parameters Parameters of the quota.
   * @param i Index in the parameters.
   */
  private boolean setStorageTypeQuota(String[] parameters, int i)
      throws IOException {
    long[] typeQuota = new long[StorageType.values().length];
    eachByStorageType(
        t -> typeQuota[t.ordinal()] = HdfsConstants.QUOTA_DONT_SET);

View on GitHub (pinned to 2add963021)

Solutions

  1. Add at least one quota flag: -nsQuota <n> and/or -ssQuota <bytes>
  2. To inspect a mount use 'hdfs dfsrouteradmin -ls /' or '-getDestination <path>' instead of -setQuota
  3. To clear quotas use -clrQuota <path>
  4. Check the script builds at least one flag: [ -n "$NS" ] || [ -n "$SS" ] || exit 1

Example fix

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

Strategy: validation

Validate before calling

[ -n "$NS_QUOTA" ] || [ -n "$SS_QUOTA" ] || { echo 'supply -nsQuota and/or -ssQuota' >&2; exit 2; }

Prevention

When it happens

Trigger: hdfs dfsrouteradmin -setQuota /mount (path only, no quota flags); a script that conditionally appends quota flags but both branches were skipped due to empty variables.

Common situations: Operators probing whether the mount exists using -setQuota; runbooks whose variable expansion produced only the mount path; mistaken belief that -setQuota alone prints current quotas (use -ls or -getDestination for that).

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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