{"record":{"id":"14639d1e48ddd2b8","repo":"apache/hadoop","slug":"expected-created-entry-to-have-a-name-field","errorCode":null,"errorMessage":"Expected <created> entry to have a <name> field","messagePattern":"Expected <created> entry to have a <name> field","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":1512,"sourceCode":"          Node deleted = dirDiff.removeChild(\n              SNAPSHOT_DIFF_SECTION_DELETED_INODE_REF);\n          if (deleted == null){\n            break;\n          }\n          bld.addDeletedINodeRef(Integer.parseInt(deleted.getVal()));\n        }\n        bld.build().writeDelimitedTo(out);\n        // After the DirectoryDiff header comes a list of CreatedListEntry PBs.\n        int actualCreatedListSize = 0;\n        while (true) {\n          Node created = dirDiff.removeChild(\n              SNAPSHOT_DIFF_SECTION_CREATED);\n          if (created == null){\n            break;\n          }\n          String cleName = created.removeChildStr(SECTION_NAME);\n          if (cleName == null) {\n            throw new IOException(\"Expected <created> entry to have \" +\n                \"a <name> field\");\n          }\n          created.verifyNoRemainingKeys(\"created\");\n          FsImageProto.SnapshotDiffSection.CreatedListEntry.newBuilder().\n              setName(ByteString.copyFrom(cleName, StandardCharsets.UTF_8)).\n              build().writeDelimitedTo(out);\n          actualCreatedListSize++;\n        }\n        if (actualCreatedListSize != expectedCreatedListSize) {\n          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","sourceCodeStart":1494,"sourceCodeEnd":1530,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java#L1494-L1530","documentation":"A <created> entry inside a <dirDiff> has no <name> child. CreatedListEntry carries only the file name, so a <created> element without <name> is empty and useless; the tool throws immediately and also calls verifyNoRemainingKeys to reject any other keys it might have carried.","triggerScenarios":"An empty <created/> tag, a <created> whose name was renamed (e.g. <fileName>), or stray children placed inside <created> during editing.","commonSituations":"Hand-added created-list entries where only a placeholder was inserted; renaming for readability; entries pasted from another diff with the name stripped.","solutions":["Add <name>FILENAME</name> as the only child of the <created> element","Remove any other children from <created> - only <name> is accepted","If the entry was accidental, delete the whole <created> element and decrement <createdListSize> accordingly","Regenerate the XML from the original image"],"exampleFix":"<!-- before -->\n<created><fileName>part-00000</fileName></created>\n<!-- after -->\n<created><name>part-00000</name></created>","handlingStrategy":"validation","validationCode":"# python: <created> entries must have exactly one <name> child\nimport xml.etree.ElementTree as ET\n\ndef created_entries_ok(path):\n    for ev, el in ET.iterparse(path, events=('end',)):\n        if el.tag == 'created':\n            kids = list(el)\n            if len(kids) != 1 or kids[0].tag != 'name' or not kids[0].text:\n                return False\n    return True","typeGuard":null,"tryCatchPattern":"// oiv failure 'Expected <created> entry to have a <name> field' ->\n// fix the named entry, delete partial output, re-run","preventionTips":["<created> carries only <name> - no other children allowed","Never leave empty <created/> placeholders in edited XML","Validate created entries with a streaming pre-check","Delete accidental entries and decrement createdListSize together"],"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"}