{"record":{"id":"bb0a7249ffca9961","repo":"apache/hadoop","slug":"no-numsnapshots-entry-found-in-snapshotsection-h","errorCode":null,"errorMessage":"No <numSnapshots> entry found in SnapshotSection header","messagePattern":"No <numSnapshots> entry found in SnapshotSection header","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":1350,"sourceCode":"    static final String NAME = \"SnapshotSection\";\n\n    @Override\n    public void process() throws IOException {\n      FsImageProto.SnapshotSection.Builder bld =\n          FsImageProto.SnapshotSection.newBuilder();\n      Node header = new Node();\n      loadNodeChildren(header, \"SnapshotSection fields\", \"snapshot\");\n      Integer snapshotCounter = header.removeChildInt(\n          SNAPSHOT_SECTION_SNAPSHOT_COUNTER);\n      if (snapshotCounter == null) {\n        throw new IOException(\"No <snapshotCounter> entry found in \" +\n            \"SnapshotSection header\");\n      }\n      bld.setSnapshotCounter(snapshotCounter);\n      Integer expectedNumSnapshots = header.removeChildInt(\n          SNAPSHOT_SECTION_NUM_SNAPSHOTS);\n      if (expectedNumSnapshots == null) {\n        throw new IOException(\"No <numSnapshots> entry found in \" +\n            \"SnapshotSection header\");\n      }\n      bld.setNumSnapshots(expectedNumSnapshots);\n      while (true) {\n        Node sd = header.removeChild(SNAPSHOT_SECTION_SNAPSHOT_TABLE_DIR);\n        if (sd == null) {\n          break;\n        }\n        Long dir;\n        while ((dir = sd.removeChildLong(SNAPSHOT_SECTION_DIR)) != null) {\n          // Add all snapshottable directories, one by one\n          bld.addSnapshottableDir(dir);\n        }\n      }\n      header.verifyNoRemainingKeys(\"SnapshotSection\");\n      bld.build().writeDelimitedTo(out);\n      int actualNumSnapshots = 0;\n      while (actualNumSnapshots < expectedNumSnapshots) {","sourceCodeStart":1332,"sourceCodeEnd":1368,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java#L1332-L1368","documentation":"Error \"No <numSnapshots> entry found in SnapshotSection header\" thrown in apache/hadoop.","triggerScenarios":"Thrown by oiv -r when the SnapshotSection header lacks the <numSnapshots> element.","commonSituations":"See trigger scenarios.","solutions":["Add the missing <numSnapshots> element to the SnapshotSection header of the fsimage XML.","Regenerate the fsimage XML with 'hdfs oiv' from a valid fsimage."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}