apache/hadoop · error · IllegalArgumentException
Value of <{tagName}> is null
Error message
Value of <{tagName}> is null What it means
ECPolicyLoader.loadSchema() reads each child field of a <schema> element and requires a non-null first text node. This IllegalArgumentException means a field element inside <schema> is empty — e.g. <k/>, <m/>, or <codec/> with no text. The message names the offending tag; k/m are reported under their internal names numDataUnits/numParityUnits.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/ECPolicyLoader.java:268
for (int i = 0; i < fields.getLength(); i++) {
Node fieldNode = fields.item(i);
if (fieldNode instanceof Element) {
Element field = (Element) fieldNode;
String tagName = field.getTagName();
if ("k".equals(tagName)) {
tagName = "numDataUnits";
} else if ("m".equals(tagName)) {
tagName = "numParityUnits";
}
// Get the nonnull text value.
Text text = (Text) field.getFirstChild();
if (text != null) {
String value = text.getData().trim();
schemaOptions.put(tagName, value);
} else {
throw new IllegalArgumentException("Value of <" + tagName
+ "> is null");
}
}
}
return new ECSchema(schemaOptions);
}
/**
* Load a EC policy from a policy element in the XML configuration file.
* @param element EC policy element
* @param schemas all valid schemas of the EC policy file
* @return EC policy
*/
private ErasureCodingPolicy loadPolicy(Element element,
Map<String, ECSchema> schemas) {
NodeList fields = element.getChildNodes();
ECSchema schema = null;View on GitHub (pinned to 2add963021)
Solutions
- Give every field inside <schema> a text value: <k>6</k> <m>3</m> <codec>rs</codec>
- Map the reported name back to the XML tag: numDataUnits=<k>, numParityUnits=<m>
- Re-run `hdfs ec -loadPolicy` after filling in the empty element
Example fix
<!-- before --> <schema id="rs-6-3"> <k>6</k><m></m><codec>rs</codec> </schema> <!-- after --> <schema id="rs-6-3"> <k>6</k><m>3</m><codec>rs</codec> </schema>
Defensive patterns
Strategy: validation
Validate before calling
for (Element schema : schemaElements(doc)) {
for (Node c = schema.getFirstChild(); c != null; c = c.getNextSibling()) {
if (c instanceof Element && c.getFirstChild() == null) {
throw new IllegalArgumentException("empty field <" + ((Element) c).getTagName() + "> in schema " + schema.getAttribute("id"));
}
}
} Try / catch
try { new ECPolicyLoader().loadPolicy(path); }
catch (IllegalArgumentException e) {
LOG.error("EC policy file {} rejected: {}", path, e.getMessage()); // numDataUnits=<k>, numParityUnits=<m>
} Prevention
- Fill every field when adding a schema: k, m, codec
- Map reported names back: numDataUnits is <k>, numParityUnits is <m>
When it happens
Trigger: `hdfs ec -loadPolicy` where a schema field is an empty element: <schema id="x"><k>6</k><m/></schema> reports 'Value of <numParityUnits> is null'.
Common situations: Deleting a field's value while editing the template, or authoring a new schema and forgetting to fill in codec or m.
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}
- Bad policy is found in EC policy configuration file
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/120258955a93bbcc.
Report an issue: GitHub.