{"record":{"id":"ab2ac2e598eb5755","repo":"apache/hadoop","slug":"inode-found-without-id","errorCode":null,"errorMessage":"<inode> found without <id>","messagePattern":"<inode> found without <id>","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":620,"sourceCode":"        loadNodeChildren(inode, \"INode fields\");\n        INodeSection.INode.Builder inodeBld = processINodeXml(inode);\n        inodeBld.build().writeDelimitedTo(out);\n      }\n      expectTagEnd(INODE_SECTION_NAME);\n      recordSectionLength(SectionName.INODE.name());\n    }\n  }\n\n  private INodeSection.INode.Builder processINodeXml(Node node)\n      throws IOException {\n    String type = node.removeChildStr(INODE_SECTION_TYPE);\n    if (type == null) {\n      throw new IOException(\"INode XML found with no <type> tag.\");\n    }\n    INodeSection.INode.Builder inodeBld = INodeSection.INode.newBuilder();\n    Long id = node.removeChildLong(SECTION_ID);\n    if (id == null) {\n      throw new IOException(\"<inode> found without <id>\");\n    }\n    inodeBld.setId(id);\n    String name = node.removeChildStr(SECTION_NAME);\n    if (name != null) {\n      inodeBld.setName(ByteString.copyFrom(name, StandardCharsets.UTF_8));\n    }\n    switch (type) {\n    case \"FILE\":\n      processFileXml(node, inodeBld);\n      break;\n    case \"DIRECTORY\":\n      processDirectoryXml(node, inodeBld);\n      break;\n    case \"SYMLINK\":\n      processSymlinkXml(node, inodeBld);\n      break;\n    default:\n      throw new IOException(\"INode XML found with unknown <type> \" +","sourceCodeStart":602,"sourceCodeEnd":638,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java#L602-L638","documentation":"After <type>, processINodeXml requires SECTION_ID (<id>) and stores it as the inode's protobuf id - the unique INodeId the NameNode assigned, bounded by <lastInodeId> in the section header. An entry without it cannot be placed in the namespace tree, so the tool fails fast.","triggerScenarios":"ReverseXML where an <inode> element had its <id> child removed or renamed, or an entry was cloned to duplicate a file and the id stripped to 'make it unique' without assigning a new one.","commonSituations":"Cloning inodes by copy-paste to duplicate files; template-based hand authoring; filters that drop 'internal' fields.","solutions":["Give every inode a unique <id> that no other inode uses and that does not exceed <lastInodeId>","Regenerate the dump instead of cloning entries; if cloning is required, assign fresh sequential ids","Sweep first: xmllint --xpath 'count(//inode[id])' must equal xmllint --xpath 'count(//inode)'"],"exampleFix":"<!-- before: cloned entry with id stripped -->\n<inode><name>part-00000-copy</name><type>FILE</type></inode>\n\n<!-- after -->\n<inode><id>16402</id><name>part-00000-copy</name><type>FILE</type></inode>","handlingStrategy":"validation","validationCode":"total=$(xmllint --xpath 'count(//inode)' fsimage.xml)\nwithId=$(xmllint --xpath 'count(//inode[id])' fsimage.xml)\n[ \"$total\" = \"$withId\" ] || { echo \"$((total-withId)) <inode> entries missing <id>\"; exit 1; }\n# ids must also be unique and <= lastInodeId\nxmllint --xpath '//inode/id/text()' fsimage.xml | tr ' ' '\\n' | sort | uniq -d | grep -q . \\\n  && { echo 'duplicate inode ids found'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Assign fresh sequential ids when cloning inodes; never ship id-less entries","Keep ids unique and bounded by <lastInodeId>","Run the id-presence/uniqueness sweep before every ReverseXML run"],"tags":["hdfs","reversexml","fsimage","required-field","inode"],"backgroundTag":"required-field-missing","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}