{"record":{"id":"9566e9d48ff49c47","repo":"apache/hadoop","slug":"no-snapshotcounter-entry-found-in-snapshotsectio","errorCode":null,"errorMessage":"No <snapshotCounter> entry found in SnapshotSection header","messagePattern":"No <snapshotCounter> 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":1343,"sourceCode":"        bld.build().writeDelimitedTo(out);\n      }\n      recordSectionLength(SectionName.FILES_UNDERCONSTRUCTION.name());\n    }\n  }\n\n  private class SnapshotSectionProcessor implements SectionProcessor {\n    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","sourceCodeStart":1325,"sourceCodeEnd":1361,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageReconstructor.java#L1325-L1361","documentation":"Error \"No <snapshotCounter> entry found in SnapshotSection header\" thrown in apache/hadoop.","triggerScenarios":"Thrown by oiv -r when the SnapshotSection header of the fsimage XML lacks the <snapshotCounter> element.","commonSituations":"See trigger scenarios.","solutions":["Add the missing <snapshotCounter> 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-22T20:17:22.307Z"}