apache/hadoop · error · IOException
Expected to find <createdListSize> in <dirDiff> section.
Error message
Expected to find <createdListSize> in <dirDiff> section.
What it means
A <dirDiff> element is missing <createdListSize>, the count of created-list entries that follow the diff header. The reconstructor needs it to set DirectoryDiff.createdListSize before scanning <created> entries, so its absence is fatal for this diff.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java:1481
throw new IOException("Expected to find <childrenSize> in " +
"<dirDiff> section.");
}
bld.setIsSnapshotRoot(dirDiff.removeChildBool(
SNAPSHOT_DIFF_SECTION_IS_SNAPSHOT_ROOT));
bld.setChildrenSize(childrenSize);
String name = dirDiff.removeChildStr(SECTION_NAME);
if (name != null) {
bld.setName(ByteString.copyFrom(name, StandardCharsets.UTF_8));
}
Node snapshotCopy = dirDiff.removeChild(
SNAPSHOT_DIFF_SECTION_SNAPSHOT_COPY);
if (snapshotCopy != null) {
bld.setSnapshotCopy(createINodeDirectoryBuilder(snapshotCopy));
}
Integer expectedCreatedListSize = dirDiff.removeChildInt(
SNAPSHOT_DIFF_SECTION_CREATED_LIST_SIZE);
if (expectedCreatedListSize == null) {
throw new IOException("Expected to find <createdListSize> in " +
"<dirDiff> section.");
}
bld.setCreatedListSize(expectedCreatedListSize);
while (true) {
Node deleted = dirDiff.removeChild(
SNAPSHOT_DIFF_SECTION_DELETED_INODE);
if (deleted == null){
break;
}
bld.addDeletedINode(Long.parseLong(deleted.getVal()));
}
while (true) {
Node deleted = dirDiff.removeChild(
SNAPSHOT_DIFF_SECTION_DELETED_INODE_REF);
if (deleted == null){
break;
}
bld.addDeletedINodeRef(Integer.parseInt(deleted.getVal()));View on GitHub (pinned to 2add963021)
Solutions
- Add <createdListSize>N</createdListSize> to the <dirDiff>, where N is the number of <created> children that follow
- Verify it is a direct child of <dirDiff>, spelled exactly 'createdListSize'
- Cross-check N against the actual <created> entries to avoid the follow-on count-mismatch error
- Regenerate the XML with a same-version oiv when in doubt
Example fix
<!-- before --> <dirDiff><snapshotId>3</snapshotId><childrenSize>5</childrenSize></dirDiff> <!-- after --> <dirDiff><snapshotId>3</snapshotId><childrenSize>5</childrenSize><createdListSize>0</createdListSize></dirDiff>
Defensive patterns
Strategy: validation
Validate before calling
# python: every <dirDiff> needs <createdListSize>
import xml.etree.ElementTree as ET
def dirdiffs_have_createdlistsize(path):
for ev, el in ET.iterparse(path, events=('end',)):
if el.tag == 'dirDiff' and el.find('createdListSize') is None:
return False
return True Try / catch
// catch oiv failure naming <createdListSize>; set it to the number of // <created> children, remove partial output, re-run
Prevention
- Always emit <createdListSize> alongside any <created> entries (0 when none)
- Keep the value synced with the actual entry count
- Validate both presence and consistency pre-flight
- Regenerate rather than guess unknown values
When it happens
Trigger: A <dirDiff> where <createdListSize> was omitted, renamed, or moved inside a sibling element such as <snapshotCopy>; also diffs assembled by scripts that emit <created> entries but not the size field.
Common situations: Hand-edited diffs where created files were added/removed without touching the size field; template-based XML generation missing the field; version-skewed writers.
Related errors
- <dirDiffEntry> contained no <inodeId> entry.
- <dirDiffEntry> contained no <count> entry.
- Expected to find <childrenSize> in <dirDiff> section.
- Expected <created> entry to have a <name> field
- <fileDiffEntry> contained no <inodeid> entry.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/ea9e7d01a79de621.
Report an issue: GitHub.