apache/hadoop · error · IOException
The <version> section doesn't contain the onDiskVersion.
Error message
The <version> section doesn't contain the onDiskVersion.
What it means
The <version> section exists but contains no <onDiskVersion> child, which becomes FileSummary.onDiskVersion in the reconstructed image header. Without it the output fsimage would have no valid summary, so the tool refuses to continue.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java:1692
* Read the version tag which starts the XML file.
*/
private void readVersion() throws IOException {
try {
expectTag("version", false);
} catch (IOException e) {
// Handle the case where <version> does not exist.
// Note: fsimage XML files which are missing <version> are also missing
// many other fields that oiv needs to accurately reconstruct the
// fsimage.
throw new IOException("No <version> section found at the top of " +
"the fsimage XML. This XML file is too old to be processed " +
"by oiv.", e);
}
Node version = new Node();
loadNodeChildren(version, "version fields");
Integer onDiskVersion = version.removeChildInt("onDiskVersion");
if (onDiskVersion == null) {
throw new IOException("The <version> section doesn't contain " +
"the onDiskVersion.");
}
Integer layoutVersion = version.removeChildInt("layoutVersion");
if (layoutVersion == null) {
throw new IOException("The <version> section doesn't contain " +
"the layoutVersion.");
}
if (layoutVersion.intValue() !=
NameNodeLayoutVersion.CURRENT_LAYOUT_VERSION) {
throw new IOException("Layout version mismatch. This oiv tool " +
"handles layout version " +
NameNodeLayoutVersion.CURRENT_LAYOUT_VERSION + ", but the " +
"XML file has <layoutVersion> " + layoutVersion + ". Please " +
"either re-generate the XML file with the proper layout version, " +
"or manually edit the XML file to be usable with this version " +
"of the oiv tool.");
}
fileSummaryBld.setOndiskVersion(onDiskVersion);View on GitHub (pinned to 2add963021)
Solutions
- Add <onDiskVersion>1</onDiskVersion> inside <version> (the value oiv itself writes)
- Check exact tag spelling/case - 'onDiskVersion'
- If unsure of the value, regenerate the XML with a same-version oiv and diff the <version> block
- Validate the version block before reconstructing
Example fix
<!-- before --> <version><layoutVersion>-66</layoutVersion></version> <!-- after --> <version><onDiskVersion>1</onDiskVersion><layoutVersion>-66</layoutVersion></version>
Defensive patterns
Strategy: validation
Validate before calling
# python: <version> must contain <onDiskVersion>
import xml.etree.ElementTree as ET
def version_block_ok(path):
for ev, el in ET.iterparse(path, events=('end',)):
if el.tag == 'version':
return el.find('onDiskVersion') is not None
return False Try / catch
// catch the missing-onDiskVersion failure; copy the <version> block from // a same-version oiv dump, delete partial output, re-run
Prevention
- Copy the whole <version> block verbatim from a same-build dump
- Treat the version block as fixed boilerplate, never hand-assemble it
- Validate the block pre-flight
- Regenerate the dump when the block is damaged
When it happens
Trigger: A <version> element whose <onDiskVersion> child was omitted, renamed, or misspelled (exact tag required), typically in hand-edited or script-generated XML.
Common situations: Hand-built version headers copied incompletely; renaming fields for readability; XML trimmed by a transform that dropped 'uninteresting' fields.
Related errors
- The <version> section doesn't contain the layoutVersion.
- <snapshot> section was missing <id>
- <dirDiffEntry> contained no <inodeId> entry.
- <dirDiffEntry> contained no <count> entry.
- Expected to find <childrenSize> in <dirDiff> section.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/305735bc14cd2ebc.
Report an issue: GitHub.