{"record":{"id":"6c87233faa9fabc9","repo":"apache/druid","slug":"invalid-histogram-serde-mode-s","errorCode":null,"errorMessage":"Invalid histogram serde mode: %s","messagePattern":"Invalid histogram serde mode: (.+?)","errorType":"exception","errorClass":"org.apache.druid.java.util.common.ISE","httpStatus":null,"severity":"error","filePath":"extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogram.java","lineNumber":980,"sourceCode":"   * Deserialization helper method\n   *\n   * @param buf Source buffer containing serialized histogram\n   * @return Deserialized object\n   */\n  public static FixedBucketsHistogram fromByteBuffer(ByteBuffer buf)\n  {\n    byte serializationVersion = buf.get();\n    Preconditions.checkArgument(\n        serializationVersion == SERIALIZATION_VERSION,\n        StringUtils.format(\"Only serialization version %s is supported.\", SERIALIZATION_VERSION)\n    );\n    byte mode = buf.get();\n    if (mode == FULL_ENCODING_MODE) {\n      return fromByteBufferFullNoSerdeHeader(buf);\n    } else if (mode == SPARSE_ENCODING_MODE) {\n      return fromBytesSparse(buf);\n    } else {\n      throw new ISE(\"Invalid histogram serde mode: %s\", mode);\n    }\n  }\n\n  /**\n   * Helper method for deserializing histograms with full encoding mode. Assumes that the serialization header is not\n   * present or has already been read.\n   *\n   * @param buf Source buffer containing serialized full-encoding histogram.\n   * @return Deserialized object\n   */\n  protected static FixedBucketsHistogram fromByteBufferFullNoSerdeHeader(ByteBuffer buf)\n  {\n    double lowerLimit = buf.getDouble();\n    double upperLimit = buf.getDouble();\n    int numBuckets = buf.getInt();\n    OutlierHandlingMode outlierHandlingMode = OutlierHandlingMode.values()[buf.get()];\n\n    long count = buf.getLong();","sourceCodeStart":962,"sourceCodeEnd":998,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogram.java#L962-L998","documentation":"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.","triggerScenarios":"Thrown at extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogram.java:980 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the serialized bytes are produced by the same Druid version's toBytes()/serialization code.","Check for byte-buffer offset or slice errors in code that hands buffers to fromByteBuffer.","Rebuild or re-ingest the segment holding the corrupted histogram."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}