# Metricbeat Kafka module won’t work with Kafka 4.0.0

**URL:** <https://discuss.elastic.co/t/metricbeat-kafka-module-won-t-work-with-kafka-4-0-0/378670>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [May 28, 2025, 10:40pm UTC](https://discuss.elastic.co/t/metricbeat-kafka-module-won-t-work-with-kafka-4-0-0/378670 "2025-05-28T22:40:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SeungHyun\_Roh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seunghyun_roh/32/100359_2.png) [@SeungHyun\_Roh](https://discuss.elastic.co/u/SeungHyun_Roh)\
**Post date:** [May 28, 2025, 10:40pm UTC](https://discuss.elastic.co/t/metricbeat-kafka-module-won-t-work-with-kafka-4-0-0/378670/1 "2025-05-28T22:40:57Z")

</div>

Hello, everyone.

I see this logs when trying to connect to Kafka 4.0.0 with Metricbeat 9.0.0 kafka module.

- Metricbeat log

```auto
{"log.level":"warn","@timestamp":"2025-05-22T16:25:44.754+0900","log.logger":"kafka.partition","log.origin":{"function":"github.com/elastic/beats/v7/metricbeat/module/kafka/partition.(*MetricSet).Fetch","file.name":"partition/partition.go","file.line":129},"message":"failed to query kafka partition (__consumer_offsets:38) offsets: failed to get oldest offset: get available offsets failed: write tcp [::1]:51096->[::1]:9092: write: broken pipe","service.name":"metricbeat","ecs.version":"1.6.0"}
{"log.level":"warn","@timestamp":"2025-05-22T16:25:44.754+0900","log.logger":"kafka.partition","log.origin":{"function":"github.com/elastic/beats/v7/metricbeat/module/kafka/partition.(*MetricSet).Fetch","file.name":"partition/partition.go","file.line":129},"message":"failed to query kafka partition (eai_topic:2) offsets: failed to get oldest offset: get available offsets failed: write tcp [::1]:51096->[::1]:9092: write: broken pipe","service.name":"metricbeat","ecs.version":"1.6.0"}
{"log.level":"warn","@timestamp":"2025-05-22T16:25:44.754+0900","log.logger":"kafka.partition","log.origin":{"function":"github.com/elastic/beats/v7/metricbeat/module/kafka/partition.(*MetricSet).Fetch","file.name":"partition/partition.go","file.line":129},"message":"failed to query kafka partition (eai_topic:0) offsets: failed to get oldest offset: get available offsets failed: write tcp [::1]:51096->[::1]:9092: write: broken pipe","service.name":"metricbeat","ecs.version":"1.6.0"}

```

- Kafka log

```auto
[2025-05-21 19:50:48,503] ERROR Closing socket for 0:0:0:0:0:0:0:1:9092-0:0:0:0:0:0:0:1:64441-0-0 because of error (kafka.network.Processor)
org.apache.kafka.common.errors.UnsupportedVersionException: Received request for api with key 2 (ListOffsets) and unsupported version 0
[2025-05-21 19:50:48,508] ERROR Exception while processing request from 0:0:0:0:0:0:0:1:9092-0:0:0:0:0:0:0:1:64441-0-0 (kafka.network.Processor)
org.apache.kafka.common.errors.UnsupportedVersionException: Received request for api with key 2 (ListOffsets) and unsupported version 0
[2025-05-21 19:51:11,896] ERROR Closing socket for 0:0:0:0:0:0:0:1:9092-0:0:0:0:0:0:0:1:64468-1-2 because of error (kafka.network.Processor)
org.apache.kafka.common.errors.UnsupportedVersionException: Received request for api with key 2 (ListOffsets) and unsupported version 0

```

I think the cause is kafka module is using removed api version that Kafka 4.0.0 doesn't support anymore.  
Here's a similar issue I found.

- [Burrow v1.9.3 is not compatible with Kafka 4.0 · Issue #843 · linkedin/Burrow · GitHub](https://github.com/linkedin/Burrow/issues/843)

Sorry for creating an issueon github before creating topic on discuss.  
This is the issue that I created.

- [Metricbeat 9.0.0 Kafka module won't work with Kafka 4.0.0 · Issue #44435 · elastic/beats · GitHub](https://github.com/elastic/beats/issues/44435)

- Version: 9.0.0

- Operating System: Rocky Linux release 8.10 (Green Obsidian)
