apache/hadoop · error · IOException

Unrecognized section {}

Error message

Unrecognized section {}

What it means

Same mechanism as the Delimited writer's variant: while iterating the FileSummary section list, SectionName.fromString() returned null for a section name this oiv build does not know. The image was written by a Hadoop newer than the tool, and PBImageXmlWriter aborts rather than silently skip a section.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageXmlWriter.java:332

          if (n1 == null) {
            return n2 == null ? 0 : -1;
          } else if (n2 == null) {
            return -1;
          } else {
            return n1.ordinal() - n2.ordinal();
          }
        }
      });

      for (FileSummary.Section s : sections) {
        fin.getChannel().position(s.getOffset());
        InputStream is = FSImageUtil.wrapInputStreamForCompression(conf,
            summary.getCodec(), new BufferedInputStream(new LimitInputStream(
                fin, s.getLength())));

        SectionName sectionName = SectionName.fromString(s.getName());
        if (sectionName == null) {
          throw new IOException("Unrecognized section " + s.getName());
        }
        switch (sectionName) {
        case NS_INFO:
          dumpNameSection(is);
          break;
        case STRING_TABLE:
          loadStringTable(is);
          break;
        case ERASURE_CODING:
          dumpErasureCodingSection(is);
          break;
        case INODE:
          dumpINodeSection(is);
          break;
        case INODE_REFERENCE:
          dumpINodeReferenceSection(is);
          break;
        case INODE_DIR:

View on GitHub (pinned to 2add963021)

Solutions

  1. Run oiv from a distribution at least as new as the NameNode that wrote the image
  2. Copy the fsimage to a host with a matching or newer Hadoop install and run oiv there
  3. No skip flag exists for unknown sections — align tool version with image version

Example fix

# before
/opt/hadoop-2.8/bin/hdfs oiv -p XML -i fsimage_new -o out.xml
# IOException: Unrecognized section ...

# after
/opt/hadoop-3.3/bin/hdfs oiv -p XML -i fsimage_new -o out.xml
Defensive patterns

Strategy: try-catch

Try / catch

try {
  new PBImageXmlWriter(conf, out).visit(file);
} catch (IOException e) {
  if (e.getMessage() != null && e.getMessage().startsWith("Unrecognized section")) {
    // tool older than image: rerun with oiv at/above the image's Hadoop version
    LOG.error("oiv too old for this fsimage: {}", e.getMessage());
  }
  throw e;
}

Prevention

When it happens

Trigger: Running `hdfs oiv -p XML` from an older Hadoop install against a fsimage containing a section type introduced later (the unknown name appears in the message).

Common situations: Version-skewed tooling after a cluster upgrade; oiv from an old tarball reused against new images.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/7d1fc20c9551f7b9. Report an issue: GitHub.