apache/druid · error · org.apache.druid.java.util.common.ISE

Invalid histogram serde mode

Error message

Invalid histogram serde mode: %s

What it means

Deserialization-mode guard in FixedBucketsHistogram.fromByteBuffer: the mode byte read from the serialized histogram buffer was neither FULL_ENCODING_MODE nor SPARSE_ENCODING_MODE, meaning the buffer is corrupt, truncated, or was written by an incompatible serialization format.

Solutions

  1. Verify the serialized bytes are produced by the same Druid version's toBytes()/serialization code.
  2. Check for byte-buffer offset or slice errors in code that hands buffers to fromByteBuffer.
  3. Rebuild or re-ingest the segment holding the corrupted histogram.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogram.java:980 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogram.java:980

   * Deserialization helper method
   *
   * @param buf Source buffer containing serialized histogram
   * @return Deserialized object
   */
  public static FixedBucketsHistogram fromByteBuffer(ByteBuffer buf)
  {
    byte serializationVersion = buf.get();
    Preconditions.checkArgument(
        serializationVersion == SERIALIZATION_VERSION,
        StringUtils.format("Only serialization version %s is supported.", SERIALIZATION_VERSION)
    );
    byte mode = buf.get();
    if (mode == FULL_ENCODING_MODE) {
      return fromByteBufferFullNoSerdeHeader(buf);
    } else if (mode == SPARSE_ENCODING_MODE) {
      return fromBytesSparse(buf);
    } else {
      throw new ISE("Invalid histogram serde mode: %s", mode);
    }
  }

  /**
   * Helper method for deserializing histograms with full encoding mode. Assumes that the serialization header is not
   * present or has already been read.
   *
   * @param buf Source buffer containing serialized full-encoding histogram.
   * @return Deserialized object
   */
  protected static FixedBucketsHistogram fromByteBufferFullNoSerdeHeader(ByteBuffer buf)
  {
    double lowerLimit = buf.getDouble();
    double upperLimit = buf.getDouble();
    int numBuckets = buf.getInt();
    OutlierHandlingMode outlierHandlingMode = OutlierHandlingMode.values()[buf.get()];

    long count = buf.getLong();

View on GitHub (pinned to 9b90983fd2)