kafka protocol_error ai_generated true

org.apache.kafka.common.errors.UnsupportedVersionException: The broker does not support the API version

ID: kafka/unsupported-version-api

Also available as: JSON · Markdown · 中文
85%Fix Rate
88%Confidence
1Evidence
2024-01-20First Seen

Root Cause

Client and broker have incompatible API versions, often due to mismatched Kafka client library and broker versions.

generic

中文

客户端和代理的API版本不兼容,通常是由于Kafka客户端库和代理版本不匹配。

Official Documentation

https://kafka.apache.org/documentation/#upgrade

Workarounds

  1. 90% success Upgrade the Kafka client library to match the broker version, e.g., in Maven: <kafka.version>3.7.0</kafka.version>
    Upgrade the Kafka client library to match the broker version, e.g., in Maven: <kafka.version>3.7.0</kafka.version>
  2. 75% success Set api.version.request to false in producer/consumer config to force client to use a specific version, e.g., props.put("api.version.request", "false");
    Set api.version.request to false in producer/consumer config to force client to use a specific version, e.g., props.put("api.version.request", "false");

中文步骤

  1. 升级Kafka客户端库以匹配代理版本,例如在Maven中:<kafka.version>3.7.0</kafka.version>
  2. 在生产/消费者配置中将 api.version.request 设置为 false,以强制客户端使用特定版本,例如 props.put("api.version.request", "false");

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Downgrading the broker version often introduces security vulnerabilities and is not recommended.

  2. 80% fail

    Manually setting API versions in client config can lead to further incompatibilities if not done carefully.