apache/hadoop · error · InvalidXmlException
More than one value found for {}
Error message
More than one value found for {} What it means
Stanza.getValueOrNull accepts an entry only when its list has exactly one stanza: it checks subtrees.containsKey(name), fetches the LinkedList, and throws InvalidXmlException("More than one value found for " + name) when l.size() != 1. In well-formed fsimage XML each scalar field appears once per parent, so a size other than 1 means malformed input (0 can also land here only if the key was added with an empty list; the common case is 2+).
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/util/XMLUtils.java:332
throw new InvalidXmlException("no entry found for " + name);
}
return ret;
}
/**
* Pull a string entry from a stanza, or null.
*
* @param name entry to look for
*
* @return the entry, or null if it was not found.
*/
public String getValueOrNull(String name) throws InvalidXmlException {
if (!subtrees.containsKey(name)) {
return null;
}
LinkedList <Stanza> l = subtrees.get(name);
if (l.size() != 1) {
throw new InvalidXmlException("More than one value found for " + name);
}
return l.get(0).getValue();
}
/**
* Add an entry to a stanza.
*
* @param name name of the entry to add
* @param child the entry to add
*/
public void addChild(String name, Stanza child) {
LinkedList<Stanza> l;
if (subtrees.containsKey(name)) {
l = subtrees.get(name);
} else {
l = new LinkedList<Stanza>();
subtrees.put(name, l);
}View on GitHub (pinned to 2add963021)
Solutions
- Remove the duplicate element so exactly one remains
- If multiple values are legitimate for your data model, read them with getChildren(name) instead of getValue(name)
- Validate uniqueness (count occurrences per parent element) before parsing
Example fix
<!-- before: duplicate element inside one parent --> <INODE><NAME>a</NAME><NAME>b</NAME></INODE> <!-- after --> <INODE><NAME>a</NAME></INODE>
Defensive patterns
Strategy: try-catch
Try / catch
try {
String v = stanza.getValue(name);
} catch (InvalidXmlException e) {
// size != 1: duplicated element in the XML stanza
} Prevention
- Ensure generators emit scalar fields exactly once per parent
- Avoid merging XML fragments that duplicate fields
- Use getChildren(name) when multiple entries are valid for your data
When it happens
Trigger: The XML contains the same element twice inside one parent (e.g. two <NAME> children under one <INODE>), so the stanza's list for that name has size 2; any getValue/getValueOrNull call on it throws.
Common situations: Merging or hand-editing OIV XML that duplicated a field; buggy XML generators emitting repeated elements; processing concatenated or diff-merged dumps.
Related errors
- no entry found for {}
- FSImage XML ended prematurely, without including section(s)
- Got unexpected tag end event for {} while looking for sectio
- Unknown or duplicate section found for {}
- Unrecognized FSImage
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/6e47d3c6d76c9f0a.
Report an issue: GitHub.