kafka
protocol_error
ai_generated
true
org.apache.kafka.common.errors.UnsupportedForMessageFormatException: 消息格式版本不支持请求的功能
org.apache.kafka.common.errors.UnsupportedForMessageFormatException: The message format version does not support the requested feature
ID: kafka/unsupported-for-message-format
90%修复率
87%置信度
1证据数
2024-03-05首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Kafka 2.8.0 | active | — | — | — |
| Kafka 3.0.0 | active | — | — | — |
| Kafka 3.2.0 | active | — | — | — |
根因分析
代理或主题使用较旧的消息格式(如v0或v1),缺少对头部、时间戳或幂等写入等功能的支持。
English
Broker or topic uses an older message format (e.g., v0 or v1) that lacks support for features like headers, timestamps, or idempotent writes.
官方文档
https://kafka.apache.org/documentation/#message_format解决方案
-
Upgrade the topic's message format version to v2 using kafka-topics. Command: kafka-topics --bootstrap-server localhost:9092 --alter --topic my-topic --config message.format.version=2.8 Verify: kafka-topics --bootstrap-server localhost:9092 --describe --topic my-topic If using older Kafka version (< 2.8), upgrade the entire cluster first.
-
Set inter.broker.protocol.version to match the cluster version and ensure all brokers are on the same version. In server.properties: inter.broker.protocol.version=3.2 log.message.format.version=3.2 Then rolling restart brokers.
无效尝试
常见但无效的做法:
-
Set enable.idempotence=false in producer
40% 失败
Disabling idempotence may work but loses exactly-once semantics; feature still unsupported at broker level.
-
Change message.format.version to a higher value in producer config
95% 失败
Producer-side config does not override broker/topic message format; broker must be upgraded.
-
Delete and recreate the topic with default settings
70% 失败
Default settings may still use old format if cluster is not upgraded; also causes data loss.