apache/druid · error · IAE

Unknown version[%s]

Error message

Unknown version[%s]

What it means

CompressedBlockReader.fromByteBuffer throws IAE("Unknown version[%s]") when the version byte at the start of a compressed block-format column does not match any version this Druid build can read. This is a segment-format compatibility check guarding against reading segments written by incompatible Druid versions.

Source

Thrown at processing/src/main/java/org/apache/druid/segment/data/CompressedBlockReader.java:108

      // move to start of compressed data
      buffer.position(buffer.position() + offsetsSize);
      final ByteBuffer compressedData = buffer.asReadOnlyBuffer().order(compressionOrder);
      compressedData.limit(compressedData.position() + compressedSize);
      buffer.position(buffer.position() + compressedSize);

      final ByteBuffer compressedDataView = compressedData.slice().order(compressionOrder);
      return () -> new CompressedBlockReader(
          compression,
          numBlocks,
          blockSize,
          copyValuesOnRead,
          offsetView.asReadOnlyBuffer(),
          compressedDataView.asReadOnlyBuffer().order(compressionOrder),
          compressionOrder,
          valueOrder
      );
    }
    throw new IAE("Unknown version[%s]", versionFromBuffer);
  }

  private final CompressionStrategy.Decompressor decompressor;

  private final boolean copyValuesOnRead;
  private final int numBlocks;
  private final int div;
  private final int rem;
  private final IntBuffer endOffsetsBuffer;
  private final ByteBuffer compressedDataBuffer;

  private final ResourceHolder<ByteBuffer> decompressedDataBufferHolder;
  private final ByteBuffer decompressedDataBuffer;

  private final ByteOrder byteOrder;
  private final Closer closer;
  private int currentBlockNumber = -1;

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Upgrade all Druid nodes (especially historicals/middle managers) to the version that wrote the segment
  2. Re-ingest or re-index the affected segments with the running Druid version
  3. Verify segment file integrity on deep storage (checksum/size) and restore from backup if corrupted
  4. Check the segment's loadSpec and version metadata in metadata store for mismatch

Example fix

// before: old node reads new-format segment
// after: upgrade and restart historicals to match writer version
// e.g., bump Druid from 0.x to the release that added the new column version
Defensive patterns

Strategy: try-catch

Validate before calling

// inspect the version byte before reading
ByteBuffer buf = columnBuffer.duplicate();
byte version = buf.get(0);
if (!SUPPORTED_VERSIONS.contains(version)) {
  throw new IllegalStateException("Segment version " + version + " not supported by this Druid build; upgrade");
}

Try / catch

try {
  reader = CompressedBlockReader.fromByteBuffer(...);
} catch (IllegalArgumentException e) {
  if (e.getMessage().startsWith("Unknown version")) {
    throw new SegmentFormatException("Upgrade Druid to read this segment", e);
  }
  throw e;
}

Prevention

When it happens

Trigger: Opening a segment whose compressed column header carries a version byte newer (or unrecognized) than the reader supports — e.g., segments written by a newer Druid, corrupted segment files, or non-Druid bytes passed to the factory.

Common situations: Rolling upgrades where an older historical node reads segments produced by a newer Druid; segment files damaged or truncated on deep storage; custom code pointing the reader at the wrong buffer offset.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/efed85d80bc42da3. Report an issue: GitHub.