apache/hadoop · error · InvalidXmlException

no entry found for {}

Error message

no entry found for {}

What it means

Stanza is the tree model the OfflineImageViewer XML processor builds from an fsimage XML dump. getChildren(name) returns the list of sub-stanzas registered under that element name; when subtrees.get(name) is null it throws InvalidXmlException("no entry found for " + name). This almost always means the XML lacks an element the reader's Hadoop version expects.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/util/XMLUtils.java:299

     * @param name        entry to look for
     * 
     * @return            true if the entry was found
     */
    public boolean hasChildren(String name) {
      return subtrees.containsKey(name);
    }
    
    /** 
     * Pull an entry from a stanza.
     *
     * @param name        entry to look for
     * 
     * @return            the entry
     */
    public List<Stanza> getChildren(String name) throws InvalidXmlException {
      LinkedList <Stanza> children = subtrees.get(name);
      if (children == null) {
        throw new InvalidXmlException("no entry found for " + name);
      }
      return children;
    }
    
    /** 
     * Pull a string entry from a stanza.
     *
     * @param name        entry to look for
     * 
     * @return            the entry
     */
    public String getValue(String name) throws InvalidXmlException {
      String ret = getValueOrNull(name);
      if (ret == null) {
        throw new InvalidXmlException("no entry found for " + name);
      }
      return ret;
    }

View on GitHub (pinned to 2add963021)

Solutions

  1. Regenerate the XML with `hdfs oiv -p XML -i fsimage_...` using the same Hadoop version that will parse it
  2. Inspect the stanza's actual element names (dump the surrounding XML) and diff against what the reader expects
  3. Catch InvalidXmlException and surface the missing element name — the message names exactly which entry was absent

Example fix

// before
List<Stanza> inodes = stanza.getChildren("INODE"); // throws if absent

// after
List<Stanza> inodes;
try {
  inodes = stanza.getChildren("INODE");
} catch (InvalidXmlException e) {
  throw new IOException("fsimage XML lacks INODE under " + parentName, e);
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  List<Stanza> kids = stanza.getChildren(name);
} catch (InvalidXmlException e) {
  // element absent from this stanza: version drift or edited XML
  LOG.warn("missing element {} in stanza", name);
}

Prevention

When it happens

Trigger: XMLLoader walking a stanza calls getChildren("INODE"), getChildren("BLOCK"), etc. on a stanza whose XML parent lacks that element — typically an fsimage XML written by a different Hadoop version, or one that was hand-edited, filtered, or truncated.

Common situations: Parsing an fsimage XML dump produced by a newer/older release with a changed layout; scripts that reformat or sanitize OIV XML output and drop elements; partially written or corrupted dumps.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/ade7e4cc542e2569. Report an issue: GitHub.