apache/hadoop · error · IOException
Only found {actualNumINodes} <inode> entries out of {expecte
Error message
Only found {actualNumINodes} <inode> entries out of {expectedNumInodes} What it means
After the header promises expectedNumINodes, the processor calls expectTag(<inode>) exactly that many times; any IOException from expectTag (typically the unexpected end of the section) is re-thrown with this progress message. It means the XML physically contains fewer <inode> elements than <numInodes> declares - a count/content mismatch, not a parse error.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java:597
Long lval = headerNode.removeChildLong(INODE_SECTION_LAST_INODE_ID);
if (lval != null) {
b.setLastInodeId(lval);
}
Integer expectedNumINodes =
headerNode.removeChildInt(INODE_SECTION_NUM_INODES);
if (expectedNumINodes == null) {
throw new IOException("Failed to find <numInodes> in INodeSection.");
}
b.setNumInodes(expectedNumINodes);
INodeSection s = b.build();
s.writeDelimitedTo(out);
headerNode.verifyNoRemainingKeys("INodeSection");
int actualNumINodes = 0;
while (actualNumINodes < expectedNumINodes) {
try {
expectTag(INODE_SECTION_INODE, false);
} catch (IOException e) {
throw new IOException("Only found " + actualNumINodes +
" <inode> entries out of " + expectedNumINodes, e);
}
actualNumINodes++;
Node inode = new Node();
loadNodeChildren(inode, "INode fields");
INodeSection.INode.Builder inodeBld = processINodeXml(inode);
inodeBld.build().writeDelimitedTo(out);
}
expectTagEnd(INODE_SECTION_NAME);
recordSectionLength(SectionName.INODE.name());
}
}
private INodeSection.INode.Builder processINodeXml(Node node)
throws IOException {
String type = node.removeChildStr(INODE_SECTION_TYPE);
if (type == null) {
throw new IOException("INode XML found with no <type> tag.");View on GitHub (pinned to 2add963021)
Solutions
- Make counts agree: set <numInodes> to the actual number of <inode> elements (or restore the missing entries)
- Regenerate the dump and prune with a DOM tool that updates counts automatically
- Rule out truncation: xmllint --noout plus a look at the tail of the file
Example fix
<!-- before: 5 inodes remain but header still says 8 --> <INodeSection><numInodes>8</numInodes>...(5 <inode> elements)...</INodeSection> <!-- after --> <INodeSection><numInodes>5</numInodes>...(5 <inode> elements)...</INodeSection>
Defensive patterns
Strategy: validation
Validate before calling
declared=$(xmllint --xpath 'string(//INodeSection/numInodes)' fsimage.xml)
actual=$(xmllint --xpath 'count(//inode)' fsimage.xml)
[ "$declared" = "$actual" ] || { echo "expected $declared inodes, found $actual - fix count or entries"; exit 1; } Prevention
- Update counts in the same commit as entry deletions
- After filtering entries programmatically, recompute all section counts
- Prefer regenerating from fsimage over subtractive XML edits
When it happens
Trigger: ReverseXML after inode entries were deleted without decrementing <numInodes>; XML truncated mid-section; entries renamed so expectTag(<inode>) no longer matches them (the original exception is chained as the cause).
Common situations: Hand-pruning namespace dumps to remove files; scripted filters that drop entries but not header counts; interrupted copies of the XML.
Related errors
- Failed to find <numInodes> in INodeSection.
- Only read ${actualNumSnapshots} <snapshot> entries out of ${
- Only read ${actualDiffs + 1} diffs out of ${expectedDiffs}
- <createdListSize> was {}, but there were {} <created> entrie
- Only read {} diffs out of {}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/fc9bb91c2154bdb3.
Report an issue: GitHub.