{"record":{"id":"ab65852ad7f07e88","repo":"apache/hadoop","slug":"cannot-parse-ssquota","errorCode":null,"errorMessage":"Cannot parse ssQuota: {}","messagePattern":"Cannot parse 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":995,"sourceCode":"    long ssQuota = HdfsConstants.QUOTA_DONT_SET;\n\n    String mount = parameters[i++];\n    while (i < parameters.length) {\n      if (parameters[i].equals(\"-nsQuota\")) {\n        i++;\n        try {\n          nsQuota = Long.parseLong(parameters[i]);\n        } catch (Exception e) {\n          throw new IllegalArgumentException(\n              \"Cannot parse nsQuota: \" + parameters[i]);\n        }\n      } 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(","sourceCodeStart":977,"sourceCodeEnd":1013,"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#L977-L1013","documentation":"Thrown by dfsrouteradmin -setQuota when the token after -ssQuota cannot be parsed by StringUtils.TraditionalBinaryPrefix.string2long. That parser accepts a whole number with an optional traditional binary prefix (k, m, g, t, p, e -- e.g. 1536, 100GB, 5t) and nothing else. Fractional values, unit-only tokens, or embedded spaces make setQuota throw this IllegalArgumentException before contacting the Router.","triggerScenarios":"-setQuota /mount -ssQuota 1.5TB (decimals unsupported); -ssQuota GB (unit without a number); -ssQuota '100 GB' (space splits it into two tokens, 'GB' then fails); -ssQuota ten.","commonSituations":"Operators wanting '1.5 TB' and not realizing only whole numbers with binary prefixes parse; shell scripts passing unquoted or truncated values; copy-paste from spreadsheets that inserts separators (1,024).","solutions":["Use a whole number with an optional binary prefix: -ssQuota 1536GB, -ssQuota 5t, or plain bytes -ssQuota 1073741824","Replace decimal amounts with the nearest whole-unit value (1.5TB -> 1536GB)","Quote the argument and keep it a single token with no spaces or thousands separators","Verify with the usage text: hdfs dfsrouteradmin -help setQuota"],"exampleFix":"# before\nhdfs dfsrouteradmin -setQuota /mount -ssQuota 1.5TB\n# after\nhdfs dfsrouteradmin -setQuota /mount -ssQuota 1536GB","handlingStrategy":"validation","validationCode":"# accept integer or integer+binary suffix (k,m,g,t,p,e), reject decimals/units-only\nif ! [[ \"$SS\" =~ ^-?[0-9]+[kKmMgGtTpPeE]?$ ]]; then\n  echo \"ssQuota must be like 1536GB or 1073741824 (no decimals)\" >&2; exit 2\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Convert 1.5-style values to whole units before submitting (1.5TB -> 1536GB)","Keep the value one token: no spaces, no thousands separators","Prefer bytes for machine-generated quotas"],"tags":["hdfs","rbf","federation","quota","cli","number-format"],"backgroundTag":"number-format-exception","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}