kafka
config_error
ai_generated
true
org.apache.kafka.common.errors.RecordTooLargeException: The request included a message larger than the max message size the server will accept.
ID: kafka/max-message-bytes-exceeded
85%Fix Rate
88%Confidence
1Evidence
2023-01-20First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Kafka 2.8.0 | active | — | — | — |
| Kafka 3.0.0 | active | — | — | — |
| Kafka 3.4.0 | active | — | — | — |
| Kafka 3.6.0 | active | — | — | — |
Root Cause
A producer sent a message that exceeds the broker's max.message.bytes or the topic's max.message.bytes configuration, causing the broker to reject it.
generic中文
生产者发送的消息超过了代理的 max.message.bytes 或主题的 max.message.bytes 配置,导致代理拒绝该消息。
Official Documentation
https://kafka.apache.org/documentation/#max.message.bytesWorkarounds
-
90% success Increase the broker's max.message.bytes in server.properties and the topic's max.message.bytes if overridden: # server.properties max.message.bytes=10485760 # 10 MB # Topic override alter topic my_topic --config max.message.bytes=10485760 Also increase the producer's max.request.size to match: Properties props = new Properties(); props.put("max.request.size", 10485760);
Increase the broker's max.message.bytes in server.properties and the topic's max.message.bytes if overridden: # server.properties max.message.bytes=10485760 # 10 MB # Topic override alter topic my_topic --config max.message.bytes=10485760 Also increase the producer's max.request.size to match: Properties props = new Properties(); props.put("max.request.size", 10485760); -
85% success Split large messages into smaller chunks at the application level before sending, and reassemble on the consumer side. For example, use a message chunking library or implement custom logic.
Split large messages into smaller chunks at the application level before sending, and reassemble on the consumer side. For example, use a message chunking library or implement custom logic.
中文步骤
Increase the broker's max.message.bytes in server.properties and the topic's max.message.bytes if overridden: # server.properties max.message.bytes=10485760 # 10 MB # Topic override alter topic my_topic --config max.message.bytes=10485760 Also increase the producer's max.request.size to match: Properties props = new Properties(); props.put("max.request.size", 10485760);Split large messages into smaller chunks at the application level before sending, and reassemble on the consumer side. For example, use a message chunking library or implement custom logic.
Dead Ends
Common approaches that don't work:
-
Increase the producer's max.request.size only
80% fail
max.request.size controls the client-side buffer, but the broker's max.message.bytes still blocks the message; both must be increased.
-
Set the message compression to gzip
70% fail
Compression reduces size but does not guarantee the compressed message will be under the limit; large uncompressed data may still exceed it.