{"record":{"id":"e4d29a19f0cb5989","repo":"apache/hadoop","slug":"input-quota-value-should-be-a-positive-number","errorCode":null,"errorMessage":"Input quota value should be a positive number.","messagePattern":"Input quota value should be a positive number\\.","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":1007,"sourceCode":"      } else if (parameters[i].equals(\"-ssQuota\")) {\n        i++;\n        try {\n          ssQuota = StringUtils.TraditionalBinaryPrefix\n              .string2long(parameters[i]);\n        } catch (Exception e) {\n          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   */","sourceCodeStart":989,"sourceCodeEnd":1025,"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#L989-L1025","documentation":"After parsing, setQuota rejects any explicitly supplied quota value <= 0. Both quotas default to HdfsConstants.QUOTA_DONT_SET (Long.MAX_VALUE), which passes this check, so the error fires only when you typed a zero or negative number yourself. Clearing a quota has a dedicated command that internally uses the QUOTA_RESET (-1) sentinel, so negative/zero values are never valid input here.","triggerScenarios":"-setQuota /mount -nsQuota 0; -nsQuota -100; -ssQuota 0 or -ssQuota -5GB. Each parses fine, then fails the positivity check.","commonSituations":"Attempts to 'disable' a quota by setting 0 or -1; sign typos; automation that computes a quota which underflows or defaults to 0 when a lookup fails.","solutions":["Supply a positive value: -nsQuota 100000, -ssQuota 100GB","To clear quotas use 'hdfs dfsrouteradmin -clrQuota <path>' (internally sends QUOTA_RESET)","Guard scripts so a failed quota lookup aborts instead of passing 0 to the CLI"],"exampleFix":"# before\nhdfs dfsrouteradmin -setQuota /mount -nsQuota 0\n# after (clear the quota instead)\nhdfs dfsrouteradmin -clrQuota /mount","handlingStrategy":"validation","validationCode":"if [ \"$QUOTA\" -le 0 ] 2>/dev/null; then echo \"quota must be > 0; use -clrQuota to remove\" >&2; exit 2; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never use 0 or -1 to 'disable' a quota; use -clrQuota","Abort automation when quota lookup fails instead of defaulting to 0"],"tags":["hdfs","rbf","federation","quota","validation","cli"],"backgroundTag":"quota-validation-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}