{"record":{"id":"f20749b88c72e556","repo":"apache/hadoop","slug":"unknown-diffentry-type","errorCode":null,"errorMessage":"unknown DiffEntry type {}","messagePattern":"unknown DiffEntry type (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageXmlWriter.java","lineNumber":750,"sourceCode":"  }\n\n  private void dumpSnapshotDiffSection(InputStream in) throws IOException {\n    out.print(\"<\" + SNAPSHOT_DIFF_SECTION_NAME + \">\");\n    while (true) {\n      SnapshotDiffSection.DiffEntry e = SnapshotDiffSection.DiffEntry\n          .parseDelimitedFrom(in);\n      if (e == null) {\n        break;\n      }\n      switch (e.getType()) {\n      case FILEDIFF:\n        out.print(\"<\" + SNAPSHOT_DIFF_SECTION_FILE_DIFF_ENTRY + \">\");\n        break;\n      case DIRECTORYDIFF:\n        out.print(\"<\" + SNAPSHOT_DIFF_SECTION_DIR_DIFF_ENTRY + \">\");\n        break;\n      default:\n        throw new IOException(\"unknown DiffEntry type \" + e.getType());\n      }\n      o(SNAPSHOT_DIFF_SECTION_INODE_ID, e.getInodeId());\n      o(SNAPSHOT_DIFF_SECTION_COUNT, e.getNumOfDiff());\n      switch (e.getType()) {\n      case FILEDIFF: {\n        for (int i = 0; i < e.getNumOfDiff(); ++i) {\n          out.print(\"<\" + SNAPSHOT_DIFF_SECTION_FILE_DIFF + \">\");\n          SnapshotDiffSection.FileDiff f = SnapshotDiffSection.FileDiff\n              .parseDelimitedFrom(in);\n          o(SNAPSHOT_DIFF_SECTION_SNAPSHOT_ID, f.getSnapshotId())\n              .o(SNAPSHOT_DIFF_SECTION_SIZE, f.getFileSize())\n              .o(SECTION_NAME, f.getName().toStringUtf8());\n          INodeSection.INodeFile snapshotCopy = f.getSnapshotCopy();\n          if (snapshotCopy != null) {\n            out.print(\"<\" + SNAPSHOT_DIFF_SECTION_SNAPSHOT_COPY + \">\");\n            dumpINodeFile(snapshotCopy);\n            out.print(\"</\" + SNAPSHOT_DIFF_SECTION_SNAPSHOT_COPY + \">\\n\");\n          }","sourceCodeStart":732,"sourceCodeEnd":768,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageXmlWriter.java#L732-L768","documentation":"While dumping the SNAPSHOT_DIFF section to XML, a DiffEntry message carried a type other than FILEDIFF or DIRECTORYDIFF. Protobuf round-trips unknown enum numbers, so this happens when the image contains a DiffEntry type added in a Hadoop newer than this oiv build's generated protobufs — or, less likely, bit corruption decoding to an out-of-range type value.","triggerScenarios":"`hdfs oiv -p XML` on an image from a newer Hadoop that introduced a new snapshot diff entry kind; corrupted bytes inside the snapshot diff section.","commonSituations":"Snapshotted namespaces read with old tooling after a cluster upgrade.","solutions":["Use an oiv build at least as new as the cluster that took the snapshots","Verify the image md5 to rule out in-section corruption","If versions cannot be aligned and snapshots are not needed, file a HADOOP JIRA with the type value shown in the message"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  new PBImageXmlWriter(conf, out).visit(file);\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"unknown DiffEntry type\")) {\n    // newer protobuf enum value than this build knows: align tool version\n    LOG.error(\"snapshot diff type unknown to this oiv build: {}\", e.getMessage());\n  }\n  throw e;\n}","preventionTips":["Run oiv from a distribution at least as new as the cluster that took the snapshots","Verify the fsimage md5 before analysis to separate corruption from version skew","Record the type value from the message when escalating upstream"],"tags":["hdfs","offline-image-viewer","protobuf","snapshot","version-mismatch"],"backgroundTag":"unknown-proto-enum-value","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}