apache/hadoop · error · IOException
unknown DiffEntry type {}
Error message
unknown DiffEntry type {} What it means
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.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageXmlWriter.java:750
}
private void dumpSnapshotDiffSection(InputStream in) throws IOException {
out.print("<" + SNAPSHOT_DIFF_SECTION_NAME + ">");
while (true) {
SnapshotDiffSection.DiffEntry e = SnapshotDiffSection.DiffEntry
.parseDelimitedFrom(in);
if (e == null) {
break;
}
switch (e.getType()) {
case FILEDIFF:
out.print("<" + SNAPSHOT_DIFF_SECTION_FILE_DIFF_ENTRY + ">");
break;
case DIRECTORYDIFF:
out.print("<" + SNAPSHOT_DIFF_SECTION_DIR_DIFF_ENTRY + ">");
break;
default:
throw new IOException("unknown DiffEntry type " + e.getType());
}
o(SNAPSHOT_DIFF_SECTION_INODE_ID, e.getInodeId());
o(SNAPSHOT_DIFF_SECTION_COUNT, e.getNumOfDiff());
switch (e.getType()) {
case FILEDIFF: {
for (int i = 0; i < e.getNumOfDiff(); ++i) {
out.print("<" + SNAPSHOT_DIFF_SECTION_FILE_DIFF + ">");
SnapshotDiffSection.FileDiff f = SnapshotDiffSection.FileDiff
.parseDelimitedFrom(in);
o(SNAPSHOT_DIFF_SECTION_SNAPSHOT_ID, f.getSnapshotId())
.o(SNAPSHOT_DIFF_SECTION_SIZE, f.getFileSize())
.o(SECTION_NAME, f.getName().toStringUtf8());
INodeSection.INodeFile snapshotCopy = f.getSnapshotCopy();
if (snapshotCopy != null) {
out.print("<" + SNAPSHOT_DIFF_SECTION_SNAPSHOT_COPY + ">");
dumpINodeFile(snapshotCopy);
out.print("</" + SNAPSHOT_DIFF_SECTION_SNAPSHOT_COPY + ">\n");
}View on GitHub (pinned to 2add963021)
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
Defensive patterns
Strategy: try-catch
Try / catch
try {
new PBImageXmlWriter(conf, out).visit(file);
} catch (IOException e) {
if (e.getMessage() != null && e.getMessage().contains("unknown DiffEntry type")) {
// newer protobuf enum value than this build knows: align tool version
LOG.error("snapshot diff type unknown to this oiv build: {}", e.getMessage());
}
throw e;
} Prevention
- 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
When it happens
Trigger: `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.
Common situations: Snapshotted namespaces read with old tooling after a cluster upgrade.
Related errors
- Unrecognized section {}
- Unsupported file version {}
- Unrecognized section {s.getName()}
- Cannot process fslayout version {imageVersion}
- Unrecognized section {}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/f20749b88c72e556.
Report an issue: GitHub.