kafka protocol_error ai_generated true

org.apache.kafka.common.errors.UnsupportedForMessageFormatException: The message format version does not support the requested feature

ID: kafka/unsupported-for-message-format

Also available as: JSON · Markdown · 中文
90%Fix Rate
87%Confidence
1Evidence
2024-03-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Kafka 2.8.0 active
Kafka 3.0.0 active
Kafka 3.2.0 active

Root Cause

Broker or topic uses an older message format (e.g., v0 or v1) that lacks support for features like headers, timestamps, or idempotent writes.

generic

中文

代理或主题使用较旧的消息格式(如v0或v1),缺少对头部、时间戳或幂等写入等功能的支持。

Official Documentation

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

Workarounds

  1. 90% success 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.
    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.
  2. 85% success 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 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.

中文步骤

  1. 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.
  2. 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.

Dead Ends

Common approaches that don't work:

  1. Set enable.idempotence=false in producer 40% fail

    Disabling idempotence may work but loses exactly-once semantics; feature still unsupported at broker level.

  2. Change message.format.version to a higher value in producer config 95% fail

    Producer-side config does not override broker/topic message format; broker must be upgraded.

  3. Delete and recreate the topic with default settings 70% fail

    Default settings may still use old format if cluster is not upgraded; also causes data loss.