{"record":{"id":"b98a3deb40927e1b","repo":"apache/hadoop","slug":"filediffentry-contained-no-inodeid-entry","errorCode":null,"errorMessage":"<fileDiffEntry> contained no <inodeid> entry.","messagePattern":"<fileDiffEntry> 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":1540,"sourceCode":"          throw new IOException(\"<createdListSize> was \" +\n              expectedCreatedListSize +\", but there were \" +\n              actualCreatedListSize + \" <created> entries.\");\n        }\n        dirDiff.verifyNoRemainingKeys(\"dirDiff\");\n      }\n      expectTagEnd(SNAPSHOT_DIFF_SECTION_DIR_DIFF_ENTRY);\n    }\n\n    private void processFileDiffEntry() throws IOException {\n      LOG.debug(\"Processing fileDiffEntry\");\n      DiffEntry.Builder headerBld = DiffEntry.newBuilder();\n      headerBld.setType(DiffEntry.Type.FILEDIFF);\n      Node fileDiffHeader = new Node();\n      loadNodeChildren(fileDiffHeader, \"fileDiffEntry fields\", \"fileDiff\");\n      Long inodeId = fileDiffHeader.removeChildLong(\n          SNAPSHOT_DIFF_SECTION_INODE_ID);\n      if (inodeId == null) {\n        throw new IOException(\"<fileDiffEntry> contained no <inodeid> entry.\");\n      }\n      headerBld.setInodeId(inodeId);\n      Integer expectedDiffs = fileDiffHeader.removeChildInt(\n          SNAPSHOT_DIFF_SECTION_COUNT);\n      if (expectedDiffs == null) {\n        throw new IOException(\"<fileDiffEntry> contained no <count> entry.\");\n      }\n      headerBld.setNumOfDiff(expectedDiffs);\n      fileDiffHeader.verifyNoRemainingKeys(\"fileDiffEntry\");\n      headerBld.build().writeDelimitedTo(out);\n      for (int actualDiffs = 0; actualDiffs < expectedDiffs; actualDiffs++) {\n        try {\n          expectTag(SNAPSHOT_DIFF_SECTION_FILE_DIFF, false);\n        } catch (IOException e) {\n          throw new IOException(\"Only read \" + (actualDiffs + 1) +\n              \" diffs out of \" + expectedDiffs, e);\n        }\n        Node fileDiff = new Node();","sourceCodeStart":1522,"sourceCodeEnd":1558,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java#L1522-L1558","documentation":"A <fileDiffEntry> header in <SnapshotDiffSection> is missing its inode ID child, which the protobuf DiffEntry requires. Beware the message typo: it prints '<inodeid>' lowercase, but the element actually required is <inodeId> (constant SNAPSHOT_DIFF_SECTION_INODE_ID = \"inodeId\"), exactly as in <dirDiffEntry>.","triggerScenarios":"A <fileDiffEntry> whose <inodeId> was omitted or renamed, or placed after the first <fileDiff> so it lands in diff content instead of the header; also copy-paste from dir entries where the field got stripped.","commonSituations":"Hand-built file-diff entries; scripts converting dir diffs to file diffs and dropping the ID; field-name drift across writer versions.","solutions":["Add <inodeId>NUMBER</inodeId> as the first header child of the <fileDiffEntry> (the error text 'inodeid' is a typo - the tag is 'inodeId')","Make sure it appears before the first <fileDiff> element","Check exact spelling and case","Regenerate the XML with a matching-version oiv"],"exampleFix":"<!-- before -->\n<fileDiffEntry><count>1</count><fileDiff>...</fileDiff></fileDiffEntry>\n<!-- after -->\n<fileDiffEntry><inodeId>16390</inodeId><count>1</count><fileDiff>...</fileDiff></fileDiffEntry>","handlingStrategy":"validation","validationCode":"# python: every fileDiffEntry header must contain <inodeId> (capital I and D)\nimport xml.etree.ElementTree as ET\n\ndef file_entries_have_inodeid(path):\n    for ev, el in ET.iterparse(path, events=('end',)):\n        if el.tag == 'fileDiffEntry' and el.find('inodeId') is None:\n            return False\n    return True","typeGuard":null,"tryCatchPattern":"// oiv failure '<fileDiffEntry> contained no <inodeid>' -> the required tag\n// is actually <inodeId>; add it, delete partial output, re-run","preventionTips":["Remember the message typo: it says <inodeid> but the tag is <inodeId>","Emit <inodeId> first in script-generated headers","Validate header completeness pre-flight","Reuse the dirDiffEntry header shape for fileDiffEntry"],"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"}