apache/hadoop · error · IOException

Unknown flag in CachePoolInfo: {}

Error message

Unknown flag in CachePoolInfo: {}

What it means

Cache pools are serialized with a flag word where bits 0x1..0x20 select optional fields (mode, limit, maxRelativeExpiryMs, defaultReplication, etc.). readCachePoolInfo rejects any bit outside the 0x3F mask, meaning the binary/XML was written by a release that defined a flag this build does not know, or the input was crafted/edited incorrectly.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageSerialization.java:691

      info.setOwnerName(readString(in));
    }
    if ((flags & 0x2) != 0)  {
      info.setGroupName(readString(in));
    }
    if ((flags & 0x4) != 0) {
      info.setMode(FsPermission.read(in));
    }
    if ((flags & 0x8) != 0) {
      info.setLimit(readLong(in));
    }
    if ((flags & 0x10) != 0) {
      info.setMaxRelativeExpiryMs(readLong(in));
    }
    if ((flags & 0x20) != 0) {
      info.setDefaultReplication(readShort(in));
    }
    if ((flags & ~0x3F) != 0) {
      throw new IOException("Unknown flag in CachePoolInfo: " + flags);
    }
    return info;
  }

  public static void writeCachePoolInfo(ContentHandler contentHandler,
      CachePoolInfo info) throws SAXException {
    XMLUtils.addSaxString(contentHandler, "POOLNAME", info.getPoolName());

    final String ownerName = info.getOwnerName();
    final String groupName = info.getGroupName();
    final Long limit = info.getLimit();
    final FsPermission mode = info.getMode();
    final Long maxRelativeExpiry = info.getMaxRelativeExpiryMs();
    final Short defaultReplication = info.getDefaultReplication();

    if (ownerName != null) {
      XMLUtils.addSaxString(contentHandler, "OWNERNAME", ownerName);
    }

View on GitHub (pinned to 2add963021)

Solutions

  1. Read the image/edits with the same or newer Hadoop release that wrote them
  2. Do not hand-edit OEV/OIV XML output
  3. Complete any in-flight rolling upgrade so readers are at least as new as the writer
  4. If you only need the content, dump it with the newer version's tooling instead of loading it on old binaries
Defensive patterns

Strategy: validation

Validate before calling

// before loading, confirm the image/edits layout is not newer than this build
if (summaryOrEditsLayoutVersion < HdfsServerConstants.NAMENODE_LAYOUT_VERSION) {
  throw new IOException("input written by a newer layout: "
      + summaryOrEditsLayoutVersion);
}

Try / catch

catch IOException containing 'Unknown flag in CachePoolInfo' — stop and load the input with a matching Hadoop release; do not attempt partial parsing of cache pool records.

Prevention

When it happens

Trigger: Reading a CachePoolInfo from fsimage/edits/OEV XML with (flags & ~0x3F) != 0 — typically edits or an image written by a newer Hadoop release that added a new cache-pool field, replayed on older binaries.

Common situations: Downgrade after cache pools gained new fields; loading archived journals with an older tool; hand-crafted cache pool XML.

Related errors


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