apache/hadoop · error · IllegalArgumentException
Capacity ratio config is not with correct format: {}
Error message
Capacity ratio config is not with correct format: {} What it means
Each comma-separated entry of dfs.datanode.same.disk.tiering.capacity.ratio.percentage must match the regex ^\[([0-9.]*)\](.+)$ - a bracketed number followed by a volume path. Any entry that does not match (missing brackets, missing path, stray characters) makes StorageLocation.parseCapacityRatio() throw IllegalArgumentException with the whole config string.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/StorageLocation.java:187
Map<URI, Double> result = new HashMap<>();
capacityRatioConf = capacityRatioConf.replaceAll("\\s", "");
if (capacityRatioConf.isEmpty()) {
return result;
}
String[] capacityRatios = capacityRatioConf.split(",");
for (String ratio : capacityRatios) {
Matcher matcher = CAPACITY_RATIO_REGEX.matcher(ratio);
if (matcher.matches()) {
String capacityString = matcher.group(1).trim();
String location = matcher.group(2).trim();
double capacityRatio = Double.parseDouble(capacityString);
if (capacityRatio > 1 || capacityRatio < 0) {
throw new IllegalArgumentException("Capacity ratio" + capacityRatio
+ " is not between 0 to 1: " + ratio);
}
result.put(new Path(location).toUri(), capacityRatio);
} else {
throw new IllegalArgumentException(
"Capacity ratio config is not with correct format: "
+ capacityRatioConf
);
}
}
return result;
}
@Override
public String toString() {
return "[" + storageType + "]" + baseURI.normalize();
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof StorageLocation)) {
return false;
}View on GitHub (pinned to 2add963021)
Solutions
- Format every entry as [fraction]/absolute/path - e.g. [0.3]/disk1/archive,[0.2]/disk2/archive
- Remove trailing/empty comma-separated entries
- Validate locally before deploy: every token must match Pattern \\[(\\d+\\.\\d*)\\](.+)
Example fix
# before (hdfs-site.xml) <property> <name>dfs.datanode.same.disk.tiering.capacity.ratio.percentage</name> <value>0.3:/disk1/archive,0.2:/disk2/archive</value> </property> # after <property> <name>dfs.datanode.same.disk.tiering.capacity.ratio.percentage</name> <value>[0.3]/disk1/archive,[0.2]/disk2/archive</value> </property>
Defensive patterns
Strategy: validation
Validate before calling
static boolean isValidCapacityRatioEntry(String entry) {
return entry.matches("^\\[[0-9.]+\\]/.+"); // ratio in brackets + absolute-ish path
}
// validate every comma token of the config before DN startup Prevention
- Memorize the shape: [fraction]/path - brackets mandatory, path mandatory, no '=' or ':'
- Keep one canonical example in the cluster's config repo and diff against it
When it happens
Trigger: Setting dfs.datanode.same.disk.tiering.capacity.ratio.percentage to e.g. '0.5:/disk1' (colon instead of [num]/path), 'disk1' (no ratio), '[0.5]' (no path), or leaving a trailing comma producing an empty entry; whitespace is stripped before matching, but structure must be exact.
Common situations: First-time same-disk-tiering configuration using URI-ish 'key=value' habits instead of the [ratio]/path syntax; copy-paste from docs that lost the brackets; trailing separators after edits.
Related errors
- Capacity ratio{} is not between 0 to 1: {}
- URI: {} is not in the expected format
- Xceiver count {} exceeds the limit of concurrent xceivers: {
- Cannot create directory {rootPath}
- Incompatible node types: storageType={storageType} but Stora
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/695e52d39b29ee78.
Report an issue: GitHub.