{"record":{"id":"7e86e7b48c4b496d","repo":"apache/hadoop","slug":"unknown-or-duplicate-section-found-for","errorCode":null,"errorMessage":"Unknown or duplicate section found for {}","messagePattern":"Unknown or duplicate section found for (.+?)","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":1784,"sourceCode":"        if (ev.asEndElement().getName().getLocalPart().equals(\"fsimage\")) {\n          if(unprocessedSections.size() == 1 && unprocessedSections.contains\n                  (SnapshotDiffSectionProcessor.NAME)){\n            break;\n          }\n          throw new IOException(\"FSImage XML ended prematurely, without \" +\n              \"including section(s) \" + StringUtils.join(\", \",\n              unprocessedSections));\n        }\n        throw new IOException(\"Got unexpected tag end event for \" +\n            ev.asEndElement().getName().getLocalPart() + \" while looking \" +\n            \"for section header tag.\");\n      } else if (ev.getEventType() != XMLStreamConstants.START_ELEMENT) {\n        throw new IOException(\"Expected section header START_ELEMENT; \" +\n            \"got event of type \" + ev.getEventType());\n      }\n      String sectionName = ev.asStartElement().getName().getLocalPart();\n      if (!unprocessedSections.contains(sectionName)) {\n        throw new IOException(\"Unknown or duplicate section found for \" +\n            sectionName);\n      }\n      SectionProcessor sectionProcessor = sections.get(sectionName);\n      if (sectionProcessor == null) {\n        throw new IOException(\"Unknown FSImage section \" + sectionName +\n            \".  Valid section names are [\" +\n            StringUtils.join(\", \", sections.keySet()) + \"]\");\n      }\n      unprocessedSections.remove(sectionName);\n      sectionProcessor.process();\n    }\n\n    // Write the StringTable section to disk.\n    // This has to be done after the other sections, since some of them\n    // add entries to the string table.\n    writeStringTableSection();\n\n    // Write the FileSummary section to disk.","sourceCodeStart":1766,"sourceCodeEnd":1802,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java#L1766-L1802","documentation":"ReverseXML read a top-level element whose name is either not a registered fsimage section or was already consumed: each section may occur exactly once, and the unprocessedSections set shrinks as sections are processed, so a second occurrence of the same element (or an element name that is not a section at all) fails this check.","triggerScenarios":"The same section element appearing twice (e.g. two <INODE> blocks from merging two XML files), or an element that is not an fsimage section placed as a direct child of <fsimage>.","commonSituations":"Concatenating or merging OIV XML outputs from two fsimages; copy-paste duplication while editing; inserting wrapper or annotation elements at top level.","solutions":["Search the XML for the element name in the message; keep exactly one occurrence and delete the duplicate","Remove any non-section elements from directly under <fsimage>","Regenerate the XML from a single fsimage instead of merging two outputs"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# each top-level section may appear exactly once\nimport xml.etree.ElementTree as ET\nfrom collections import Counter\nroot = ET.parse('fsimage.xml').getroot()\ndupes = [tag for tag, n in Counter(c.tag for c in root).items() if n > 1]\nif dupes:\n    raise SystemExit(f'duplicate section elements: {dupes}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never merge the XML outputs of two different fsimages for ReverseXML","After editing, re-check top-level element counts against the original file","Keep one fsimage-to-XML-to-fsimage pipeline per source image"],"tags":["hdfs","offline-image-viewer","xml","fsimage"],"backgroundTag":"duplicate-element","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}