{"record":{"id":"6c477844d4045374","repo":"apache/druid","slug":"unable-to-deserialize-bloomkfilter","errorCode":null,"errorMessage":"Unable to deserialize BloomKFilter","messagePattern":"Unable to deserialize BloomKFilter","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java","lineNumber":285,"sourceCode":"  public static BloomKFilter deserialize(ByteBuffer in, int position) throws IOException\n  {\n    if (in == null) {\n      throw new IOException(\"Input stream is null\");\n    }\n\n    try {\n      ByteBuffer dataBuffer = in.duplicate().order(ByteOrder.BIG_ENDIAN);\n      dataBuffer.position(position);\n      int numHashFunc = dataBuffer.get();\n      int bitsetArrayLen = dataBuffer.getInt();\n      long[] data = new long[bitsetArrayLen];\n      for (int i = 0; i < bitsetArrayLen; i++) {\n        data[i] = dataBuffer.getLong();\n      }\n      return new BloomKFilter(data, numHashFunc);\n    }\n    catch (RuntimeException e) {\n      throw new IOException(\"Unable to deserialize BloomKFilter\", e);\n    }\n  }\n\n  /**\n   * Merges BloomKFilter bf2Buffer into bf1Buffer in place. Does not mutate buffer positions.\n   * Assumes 2 BloomKFilters with the same size/hash functions are serialized to ByteBuffers\n   *\n   * @param bf1Buffer\n   * @param bf1Start\n   * @param bf2Buffer\n   * @param bf2Start\n   */\n  public static void mergeBloomFilterByteBuffers(\n      ByteBuffer bf1Buffer,\n      int bf1Start,\n      ByteBuffer bf2Buffer,\n      int bf2Start\n  )","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java#L267-L303","documentation":"BloomKFilter.deserialize() reads the header (numHashFunctions, bitset length) and the long[] bitset from the buffer inside a try block; any RuntimeException — most often a negative bitset length, buffer underflow, or invalid hash-function count caused by corrupt or truncated serialized bytes — is caught and rethrown as an IOException with this message. The faulty input is the serialized bloom filter bytes.","triggerScenarios":"Thrown at extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java:285 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check whether the serialized bloom filter bytes were truncated or corrupted in storage or transit","Verify the filter was written by a compatible BloomKFilter version (header layout matches BIG_ENDIAN expectations)","Re-aggregate or re-ingest the affected data to regenerate valid filters"],"exampleFix":null,"handlingStrategy":"try-catch","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"}