apache/hadoop · error · RuntimeException
Bad policy is found in EC policy configuration file
Error message
Bad policy is found in EC policy configuration file
What it means
Final validation in ECPolicyLoader.loadPolicy(Element, Map): a policy is accepted only if the referenced schema was resolved (schema != null, i.e. the <schema> text matches an id defined in <schemas>) AND the parsed cellSize is > 0. Anything else — unknown schema id, missing <cellsize> (defaults to 0), or cellsize <= 0 — throws this RuntimeException without naming the policy.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/ECPolicyLoader.java:323
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Bad EC policy cellsize"
+ " value " + value + " is found. It should be an integer");
}
} else {
LOG.warn("Invalid tagName: " + tagName);
}
}
} else {
throw new IllegalArgumentException("Value of <" + tagName
+ "> is null");
}
}
}
if (schema != null && cellSize > 0) {
return new ErasureCodingPolicy(schema, cellSize);
} else {
throw new RuntimeException("Bad policy is found in"
+ " EC policy configuration file");
}
}
}
View on GitHub (pinned to 2add963021)
Solutions
- Check every <policy><schema> value against the ids in <schemas> and fix typos or renames
- Add or correct the cell size: <cellsize>1048576</cellsize> (must be a positive integer)
- Since the message does not name the policy, bisect: load with a single policy first, then add the rest back one by one
Example fix
<!-- before -->
<schemas>
<schema id="rs-6-3">...</schema>
</schemas>
<policies>
<policy>
<name>RS-6-3</name>
<schema>rs-63</schema> <!-- typo: no such id -->
<cellsize>1048576</cellsize>
</policy>
</policies>
<!-- after -->
<schema>rs-6-3</schema> Defensive patterns
Strategy: validation
Validate before calling
Set<String> schemaIds = idsOf(doc, "schema");
for (Element p : policyElements(doc)) {
String ref = textOf(p, "schema");
if (!schemaIds.contains(ref)) throw new IllegalArgumentException("policy references unknown schema id " + ref);
if (Integer.parseInt(textOf(p, "cellsize")) <= 0) throw new IllegalArgumentException("policy cellsize must be > 0");
} Try / catch
try { new ECPolicyLoader().loadPolicy(path); }
catch (RuntimeException e) {
LOG.error("EC policy file {} rejected: {}", path, e.getMessage()); // bisect policies if unclear
} Prevention
- Keep schema ids and policy references in one place; rename both together
- Load-test new policy files on a test cluster before production `hdfs ec -loadPolicy`
When it happens
Trigger: `hdfs ec -loadPolicy` where a policy references a schema id that is not defined in the <schemas> block (e.g. 'rs-3-2' with no matching <schema id="rs-3-2">), or the policy has no <cellsize> element at all so cellSize stays 0.
Common situations: Renaming a schema id but not the policies referencing it; deleting a schema while leaving its policies; authoring a policy with only <name> and <schema> because the template's cellsize line was lost.
Understand the failure class
Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.
Related errors
- Bad EC policy configuration file: top-level element not <con
- Bad EC policy configuration file: no <policies> element
- Bad EC policy configuration file: no <schemas> element
- Bad element in EC policy configuration file: {tagName}
- Value of <{tagName}> is null
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/b9f61a81ca680a31.
Report an issue: GitHub.