apache/hadoop · error · IllegalArgumentException
Input quota value should be a positive number.
Error message
Input quota value should be a positive number.
What it means
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.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/tools/federation/RouterAdmin.java:1007
} 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);
}
/**
* Set storage type quota for a mount table entry.
*
* @param parameters Parameters of the quota.
* @param i Index in the parameters.
*/View on GitHub (pinned to 2add963021)
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
Example fix
# before hdfs dfsrouteradmin -setQuota /mount -nsQuota 0 # after (clear the quota instead) hdfs dfsrouteradmin -clrQuota /mount
Defensive patterns
Strategy: validation
Validate before calling
if [ "$QUOTA" -le 0 ] 2>/dev/null; then echo "quota must be > 0; use -clrQuota to remove" >&2; exit 2; fi
Prevention
- Never use 0 or -1 to 'disable' a quota; use -clrQuota
- Abort automation when quota lookup fails instead of defaulting to 0
When it happens
Trigger: -setQuota /mount -nsQuota 0; -nsQuota -100; -ssQuota 0 or -ssQuota -5GB. Each parses fine, then fails the positivity check.
Common situations: 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.
Related errors
- Cannot parse nsQuota: {}
- Cannot parse ssQuota: {}
- Invalid argument : {}
- Must specify at least one of -nsQuota and -ssQuota.
- The operation is not allowed because there are mount points:
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/e4d29a19f0cb5989.
Report an issue: GitHub.