{"record":{"id":"46c9fdfd652c7751","repo":"apache/hadoop","slug":"namesection-is-missing-namespaceid","errorCode":null,"errorMessage":"<NameSection> is missing <namespaceId>","messagePattern":"<NameSection> is missing <namespaceId>","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":457,"sourceCode":"     * Process this section.\n     */\n    void process() throws IOException;\n  }\n\n  /**\n   * Processes the NameSection containing last allocated block ID, etc.\n   */\n  private class NameSectionProcessor implements SectionProcessor {\n    static final String NAME = \"NameSection\";\n\n    @Override\n    public void process() throws IOException {\n      Node node = new Node();\n      loadNodeChildren(node, \"NameSection fields\");\n      NameSystemSection.Builder b =  NameSystemSection.newBuilder();\n      Integer namespaceId = node.removeChildInt(NAME_SECTION_NAMESPACE_ID);\n      if (namespaceId == null)  {\n        throw new IOException(\"<NameSection> is missing <namespaceId>\");\n      }\n      b.setNamespaceId(namespaceId);\n      Long lval = node.removeChildLong(NAME_SECTION_GENSTAMPV1);\n      if (lval != null)  {\n        b.setGenstampV1(lval);\n      }\n      lval = node.removeChildLong(NAME_SECTION_GENSTAMPV2);\n      if (lval != null)  {\n        b.setGenstampV2(lval);\n      }\n      lval = node.removeChildLong(NAME_SECTION_GENSTAMPV1_LIMIT);\n      if (lval != null)  {\n        b.setGenstampV1Limit(lval);\n      }\n      lval = node.removeChildLong(NAME_SECTION_LAST_ALLOCATED_BLOCK_ID);\n      if (lval != null)  {\n        b.setLastAllocatedBlockId(lval);\n      }","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java#L439-L475","documentation":"NameSectionProcessor loads the <NameSection> children into a Node tree and requires <namespaceId> (NAME_SECTION_NAMESPACE_ID) to be present and integer-parsable; it is the first mandatory field set on the protobuf NameSystemSection. A null return means the section is incomplete - the element was deleted, renamed, or never generated by the source dump.","triggerScenarios":"ReverseXML after <namespaceId> was removed or retagged inside <NameSection>, or after merging header sections from dumps of different versions that omit it.","commonSituations":"Attempts to change namespace identity by editing the XML; trimming 'unneeded' fields when shrinking very large dumps.","solutions":["Restore <namespaceId> with the cluster's namespace ID (visible in the original oiv XML dump or the NameNode startup log)","Regenerate the XML from the source fsimage and redo edits without dropping required fields","Before running ReverseXML, check presence: xmllint --xpath '//NameSection/namespaceId' img.xml"],"exampleFix":"<!-- before -->\n<NameSection><genstampV2>1000</genstampV2></NameSection>\n\n<!-- after -->\n<NameSection><namespaceId>1234567890</namespaceId><genstampV2>1000</genstampV2></NameSection>","handlingStrategy":"validation","validationCode":"xmllint --xpath 'string(//NameSection/namespaceId)' fsimage.xml | grep -qE '^-?[0-9]+$' \\\n  || { echo '<NameSection> is missing a numeric <namespaceId>'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never delete header fields when trimming dumps - counts and ids are mandatory","Keep the original dump until the rebuilt fsimage loads successfully on a test NameNode","List required fields per section (namespaceId, genstampV2, etc.) in editing runbooks"],"tags":["hdfs","reversexml","fsimage","required-field","namesection"],"backgroundTag":"required-field-missing","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}