apache/druid · error · IllegalArgumentException

Unknown version[ ]

Error message

Unknown version[%s]

What it means

GenericIndexed.read() dispatches on a version byte read from the serialized header; only versions 1 and 2 are supported. When the buffer's version byte is anything else, it throws IAE 'Unknown version'. This almost always means the data being read is not a GenericIndexed (wrong offset, wrong file, or corrupt/truncated data), since persisted files are written by this same class.

Solutions

  1. Verify the buffer is positioned exactly at the start of the GenericIndexed blob (check offsets in the segment metadata).
  2. Confirm the segment was written by a compatible Druid version; re-ingest or re-version segments if the format is newer.
  3. Validate segment files for corruption (checksums, druid segment validation tools) and re-download/re-generate them.
Defensive patterns

Strategy: try-catch

Validate before calling

byte version = buffer.get(buffer.position());
if (version != 1 && version != 2) throw new IOException("Not a GenericIndexed blob, version byte=" + version);

Type guard

boolean looksLikeGenericIndexed(ByteBuffer buf) { int p = buf.position(); byte v = buf.get(p); return v == 1 || v == 2; }

Try / catch

try { return GenericIndexed.read(buffer, strategy, mapper); } catch (IAE e) { throw new SegmentCorruptException("Unknown GenericIndexed version; segment may be corrupt or from an incompatible Druid version", e); }

Prevention

When it happens

Trigger: read(ByteBuffer, ObjectStrategy, ObjectMapper) or read(ByteBuffer, ObjectStrategy) with a buffer whose first byte is not 1 or 2; misaligned reads where the buffer does not start at a GenericIndexed header.

Common situations: Reading a segment file written by an incompatible/newer Druid version, pointing at the wrong file offset after a format change, or corrupted segment files on disk.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/segment/data/GenericIndexed.java:207

      ObjectStrategy<T> strategy,
      @Nullable SegmentFileMapper fileMapper
  )
  {
    byte versionFromBuffer = buffer.get();

    if (VERSION_ONE == versionFromBuffer) {
      return createGenericIndexedVersionOne(buffer, strategy);
    } else if (VERSION_TWO == versionFromBuffer) {
      if (fileMapper == null) {
        throw DruidException.defensive(
            "use read(ByteBuffer buffer, ObjectStrategy<T> strategy, SegmentFileMapper fileMapper)"
            + " with non-null fileMapper to read version 2 indexed."
        );
      }
      return createGenericIndexedVersionTwo(buffer, strategy, fileMapper);
    }

    throw new IAE("Unknown version[%s]", versionFromBuffer);
  }

  public static <T> GenericIndexed<T> fromArray(T[] objects, ObjectStrategy<T> strategy)
  {
    return fromIterable(Arrays.asList(objects), strategy);
  }

  public static GenericIndexed<ResourceHolder<ByteBuffer>> ofCompressedByteBuffers(
      Iterable<ByteBuffer> buffers,
      CompressionStrategy compression,
      int bufferSize,
      ByteOrder order,
      Closer closer
  )
  {
    return fromIterableVersionOne(
        buffers,
        GenericIndexedWriter.compressedByteBuffersWriteObjectStrategy(compression, bufferSize, closer),

View on GitHub (pinned to 9b90983fd2)