{"record":{"id":"34ef36b01729f1c9","repo":"apache/hadoop","slug":"must-specify-at-least-one-of-nsquota-and-ssquota","errorCode":null,"errorMessage":"Must specify at least one of -nsQuota and -ssQuota.","messagePattern":"Must specify at least one of -nsQuota and -ssQuota\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/tools/federation/RouterAdmin.java","lineNumber":1013,"sourceCode":"          throw new IllegalArgumentException(\n              \"Cannot parse ssQuota: \" + parameters[i]);\n        }\n      } else {\n        throw new IllegalArgumentException(\n            \"Invalid argument : \" + parameters[i]);\n      }\n\n      i++;\n    }\n\n    if (nsQuota <= 0 || ssQuota <= 0) {\n      throw new IllegalArgumentException(\n          \"Input quota value should be a positive number.\");\n    }\n\n    if (nsQuota == HdfsConstants.QUOTA_DONT_SET &&\n        ssQuota == HdfsConstants.QUOTA_DONT_SET) {\n      throw new IllegalArgumentException(\n          \"Must specify at least one of -nsQuota and -ssQuota.\");\n    }\n\n    return updateQuota(mount, nsQuota, ssQuota);\n  }\n\n  /**\n   * Set storage type quota for a mount table entry.\n   *\n   * @param parameters Parameters of the quota.\n   * @param i Index in the parameters.\n   */\n  private boolean setStorageTypeQuota(String[] parameters, int i)\n      throws IOException {\n    long[] typeQuota = new long[StorageType.values().length];\n    eachByStorageType(\n        t -> typeQuota[t.ordinal()] = HdfsConstants.QUOTA_DONT_SET);\n","sourceCodeStart":995,"sourceCodeEnd":1031,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/tools/federation/RouterAdmin.java#L995-L1031","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Add at least one quota flag: -nsQuota <n> and/or -ssQuota <bytes>","To inspect a mount use 'hdfs dfsrouteradmin -ls /' or '-getDestination <path>' instead of -setQuota","To clear quotas use -clrQuota <path>","Check the script builds at least one flag: [ -n \"$NS\" ] || [ -n \"$SS\" ] || exit 1"],"exampleFix":"# before\nhdfs dfsrouteradmin -setQuota /mount\n# after\nhdfs dfsrouteradmin -setQuota /mount -nsQuota 100000","handlingStrategy":"validation","validationCode":"[ -n \"$NS_QUOTA\" ] || [ -n \"$SS_QUOTA\" ] || { echo 'supply -nsQuota and/or -ssQuota' >&2; exit 2; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use -ls or -getDestination to inspect mounts, not -setQuota","Scripts should fail fast when both quota variables are empty"],"tags":["hdfs","rbf","federation","quota","missing-argument","cli"],"backgroundTag":"missing-required-argument","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}