{"record":{"id":"995ff4a387907482","repo":"apache/druid","slug":"unknown-event-type-s","errorCode":null,"errorMessage":"unknown event type [%s]","messagePattern":"unknown event type \\[(.+?)\\]","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions-contrib/ambari-metrics-emitter/src/main/java/org/apache/druid/emitter/ambari/metrics/AmbariMetricsEmitter.java","lineNumber":144,"sourceCode":"            log.error(\n                \"Lost total of [%s] events because of emitter queue is full. Please increase the capacity or/and the consumer frequency\",\n                countLostEvents.get()\n            );\n          }\n        }\n      }\n      catch (InterruptedException e) {\n        log.error(e, \"got interrupted with message [%s]\", e.getMessage());\n        Thread.currentThread().interrupt();\n      }\n    } else if (event instanceof AlertEvent) {\n      for (Emitter emitter : emitterList) {\n        emitter.emit(event);\n      }\n    } else if (event instanceof SegmentMetadataEvent) {\n      // do nothing. Ignore this event type\n    } else {\n      throw new ISE(\"unknown event type [%s]\", event.getClass());\n    }\n  }\n\n  @Override\n  protected String getCollectorUri(String host)\n  {\n    return constructTimelineMetricUri(getCollectorProtocol(), host, getCollectorPort());\n  }\n\n  @Override\n  protected String getCollectorProtocol()\n  {\n    return config.getProtocol();\n  }\n\n  @Override\n  protected String getCollectorPort()\n  {","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/ambari-metrics-emitter/src/main/java/org/apache/druid/emitter/ambari/metrics/AmbariMetricsEmitter.java#L126-L162","documentation":"BloomKFilter.deserialize(ByteBuffer, int) requires a non-null buffer containing the serialized filter. If the buffer is null it throws this IOException immediately before attempting to read. Unlike the other errors in this class this is an IOException, so callers should be prepared for checked exception handling.","triggerScenarios":"Calling BloomKFilter.deserialize(null, position); passing a buffer variable that was never initialized or that came back null from an upstream lookup (e.g. missing dimension value, null expression result) directly into deserialize.","commonSituations":"Bloom filter lookup code reading a serialized filter stored in a column/lookup that is absent, so the value is null; deserialization code paths that skipped a null check on their input source; tests passing null to exercise error handling.","solutions":["Check for null before calling deserialize and handle the null case explicitly (return null / empty result).","Trace where the buffer comes from and why it is null (missing value, failed fetch) rather than letting deserialize report it.","Wrap the call in try-catch for IOException if null inputs are legitimately possible in your data."],"exampleFix":"// before\nBloomKFilter bf = BloomKFilter.deserialize(buffer, position);\n\n// after\nBloomKFilter bf = (buffer == null) ? null : BloomKFilter.deserialize(buffer, position);","handlingStrategy":"type-guard","validationCode":"if (buffer == null) {\n  return null; // or skip this value\n}","typeGuard":"BloomKFilter safeDeserialize(ByteBuffer in, int position) throws IOException {\n  return (in != null && in.remaining() > position) ? BloomKFilter.deserialize(in, position) : null;\n}","tryCatchPattern":"try {\n  return BloomKFilter.deserialize(buffer, position);\n} catch (IOException e) {\n  if (buffer == null || e.getMessage().contains(\"Input stream is null\")) {\n    return null; // treat as unknown/missing filter\n  }\n  throw e;\n}","preventionTips":["Null-check the source of the serialized filter (lookup, column value) before deserializing.","Make deserialize call sites return Optional<BloomKFilter> for absent filters.","Test the null-input path in unit tests."],"tags":["bloom-filter","null-check","deserialization","druid"],"backgroundTag":"null-argument","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}