{"record":{"id":"0186f01b3a72b7ca","repo":"apache/hadoop","slug":"found-unknown-xml-keys-in-sectionname-remainin","errorCode":null,"errorMessage":"Found unknown XML keys in {sectionName}: {remainingKeyNames}","messagePattern":"Found unknown XML keys in (.+?): (.+?)","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":327,"sourceCode":"    boolean removeChildBool(String key) throws IOException {\n      String str = removeChildStr(key);\n      if (str == null) {\n        return false;\n      }\n      return true;\n    }\n\n    String getRemainingKeyNames() {\n      if (children == null) {\n        return \"\";\n      }\n      return StringUtils.join(\", \", children.keySet());\n    }\n\n    void verifyNoRemainingKeys(String sectionName) throws IOException {\n      String remainingKeyNames = getRemainingKeyNames();\n      if (!remainingKeyNames.isEmpty()) {\n        throw new IOException(\"Found unknown XML keys in \" +\n            sectionName + \": \" + remainingKeyNames);\n      }\n    }\n\n    void setVal(String val) {\n      this.val = val;\n    }\n\n    String getVal() {\n      return val;\n    }\n\n    String dump() {\n      StringBuilder bld = new StringBuilder();\n      if ((children != null) && (!children.isEmpty())) {\n        bld.append(\"{\");\n      }\n      if (val != null) {","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java#L309-L345","documentation":"Each SectionProcessor removes the elements it understands from the parsed Node tree, then verifyNoRemainingKeys fails if anything is left (the leftover key names are joined into the message). This is the reconstructor's schema check: the section contains elements this oiv version does not recognize - misspelled, manually added, or belonging to another Hadoop version's XML dialect.","triggerScenarios":"Typos in tag names (e.g. <genstampV2Stampe>), hand-added fields in the hope they get persisted, or XML generated by a different oiv version containing extra/renamed fields that this version's processor never removes.","commonSituations":"Editing XML to inject settings or new metadata; feeding a newer Hadoop dump into an older ReverseXML.","solutions":["Remove or correct every key listed in the message - it enumerates all leftovers for the section","Regenerate the XML with the same Hadoop version that will run ReverseXML","If the fields are genuinely needed, move to a Hadoop version whose fsimage schema includes them; unknown keys are rejected by design"],"exampleFix":"<!-- before: misspelled field name -->\n<NameSection><namespaceId>1</namespaceId><genstampV2Stampe>1000</genstampV2Stampe></NameSection>\n\n<!-- after -->\n<NameSection><namespaceId>1</namespaceId><genstampV2>1000</genstampV2></NameSection>","handlingStrategy":"validation","validationCode":"# Every element of each section must be a key this oiv version consumes;\n# cheapest proxy: compare against a freshly generated dump of the same image\nhdfs oiv -p XML -i fsimage_orig -o reference.xml\nfor s in NameSection INodeSection; do\n  diff <(xmllint --xpath \"//$s/*[name()]\" reference.xml | tr '>' '>\n' | cut -d'<' -f2 | cut -d' ' -f1 | sort -u) \\\n       <(xmllint --xpath \"//$s/*[name()]\" fsimage.xml  | tr '>' '>\n' | cut -d'<' -f2 | cut -d' ' -f1 | sort -u) \\\n    || { echo \"unknown/missing keys in <$s>\"; exit 1; }\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate and reconstruct with the same Hadoop version so key sets match","Spell-check tag names against a freshly generated dump after every edit session","Do not invent new elements expecting them to be persisted - unknown keys are rejected by design"],"tags":["hdfs","reversexml","xml-schema","fsimage"],"backgroundTag":"unknown-xml-elements","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}