{"record":{"id":"e16c8fe877ba731e","repo":"apache/hadoop","slug":"dirdiffentry-contained-no-inodeid-entry","errorCode":null,"errorMessage":"<dirDiffEntry> contained no <inodeId> entry.","messagePattern":"<dirDiffEntry> contained no <inodeId> entry\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java","lineNumber":1433,"sourceCode":"          processFileDiffEntry();\n        } else {\n          throw new IOException(\"SnapshotDiffSection contained unexpected \" +\n              \"tag \" + tagName);\n        }\n      }\n      recordSectionLength(SectionName.SNAPSHOT_DIFF.name());\n    }\n\n    private void processDirDiffEntry() throws IOException {\n      LOG.debug(\"Processing dirDiffEntry\");\n      DiffEntry.Builder headerBld = DiffEntry.newBuilder();\n      headerBld.setType(DiffEntry.Type.DIRECTORYDIFF);\n      Node dirDiffHeader = new Node();\n      loadNodeChildren(dirDiffHeader, \"dirDiffEntry fields\", \"dirDiff\");\n      Long inodeId = dirDiffHeader.removeChildLong(\n          SNAPSHOT_DIFF_SECTION_INODE_ID);\n      if (inodeId == null) {\n        throw new IOException(\"<dirDiffEntry> contained no <inodeId> entry.\");\n      }\n      headerBld.setInodeId(inodeId);\n      Integer expectedDiffs = dirDiffHeader.removeChildInt(\n          SNAPSHOT_DIFF_SECTION_COUNT);\n      if (expectedDiffs == null) {\n        throw new IOException(\"<dirDiffEntry> contained no <count> entry.\");\n      }\n      headerBld.setNumOfDiff(expectedDiffs);\n      dirDiffHeader.verifyNoRemainingKeys(\"dirDiffEntry\");\n      headerBld.build().writeDelimitedTo(out);\n      for (int actualDiffs = 0; actualDiffs < expectedDiffs; actualDiffs++) {\n        try {\n          expectTag(SNAPSHOT_DIFF_SECTION_DIR_DIFF, false);\n        } catch (IOException e) {\n          throw new IOException(\"Only read \" + (actualDiffs + 1) +\n              \" diffs out of \" + expectedDiffs, e);\n        }\n        Node dirDiff = new Node();","sourceCodeStart":1415,"sourceCodeEnd":1451,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java#L1415-L1451","documentation":"A <dirDiffEntry> header in <SnapshotDiffSection> is missing its <inodeId> child, which the protobuf DiffEntry requires to identify the directory the diffs belong to. The reconstructor loads the entry's header fields (everything up to the first <dirDiff> terminator) and removeChildLong(\"inodeId\") returned null.","triggerScenarios":"A <dirDiffEntry> whose <inodeId> child was omitted, renamed, or misspelled (the parser matches the exact tag 'inodeId', case-sensitive), or whose header fields were accidentally nested inside the first <dirDiff>.","commonSituations":"Hand-edited entries where the ID was dropped; scripts generating dir-diff entries from a different schema; reordering that moved <inodeId> below the <dirDiff> terminator so it lands in the diff body instead of the header.","solutions":["Add <inodeId>NUMBER</inodeId> as the first header child of the affected <dirDiffEntry>","Verify <inodeId> sits before the first <dirDiff> element - anything after it is treated as diff content, not header","Check spelling/case: the tag must be exactly 'inodeId'","Regenerate the XML with a same-version oiv if the section is beyond manual repair"],"exampleFix":"<!-- before -->\n<dirDiffEntry><count>2</count><dirDiff>...</dirDiff></dirDiffEntry>\n<!-- after -->\n<dirDiffEntry><inodeId>16386</inodeId><count>2</count><dirDiff>...</dirDiff></dirDiffEntry>","handlingStrategy":"validation","validationCode":"# python: each dirDiffEntry header must contain <inodeId> before the first <dirDiff>\nimport xml.etree.ElementTree as ET\n\ndef dir_entries_have_inodeid(path):\n    for ev, el in ET.iterparse(path, events=('end',)):\n        if el.tag == 'dirDiffEntry' and el.find('inodeId') is None:\n            return False\n    return True","typeGuard":null,"tryCatchPattern":"if oiv_reverse_xml_fails():\n    # stderr pinpoints '<dirDiffEntry> contained no <inodeId> entry.'\n    # fix that element, delete the partial output, retry once\n    ...","preventionTips":["Always emit <inodeId> first in entry headers generated by scripts","Place header fields before the first nested <dirDiff>","Validate header completeness with iterparse before reconstruction","Regenerate from the binary image rather than rebuilding entries by hand"],"tags":["hdfs","oiv","fsimage","reversexml","snapshot-diff","missing-field"],"backgroundTag":"missing-required-xml-element","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}