{
  "id": "kafka/max-message-bytes-exceeded",
  "signature": "org.apache.kafka.common.errors.RecordTooLargeException: The request included a message larger than the max message size the server will accept.",
  "signature_zh": "org.apache.kafka.common.errors.RecordTooLargeException: 请求包含的消息大于服务器将接受的最大消息大小。",
  "regex": "org\\.apache\\.kafka\\.common\\.errors\\.RecordTooLargeException: The request included a message larger than the max message size the server will accept\\.",
  "domain": "kafka",
  "category": "config_error",
  "subcategory": null,
  "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.",
  "root_cause_type": "generic",
  "root_cause_zh": "生产者发送的消息超过了代理的 max.message.bytes 或主题的 max.message.bytes 配置，导致代理拒绝该消息。",
  "versions": [
    {
      "version": "Kafka 2.8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Kafka 3.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Kafka 3.4.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Kafka 3.6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increase the producer's max.request.size only",
      "why_fails": "max.request.size controls the client-side buffer, but the broker's max.message.bytes still blocks the message; both must be increased.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Set the message compression to gzip",
      "why_fails": "Compression reduces size but does not guarantee the compressed message will be under the limit; large uncompressed data may still exceed it.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Increase the broker's max.message.bytes in server.properties and the topic's max.message.bytes if overridden:\n\n# server.properties\nmax.message.bytes=10485760  # 10 MB\n\n# Topic override\nalter topic my_topic --config max.message.bytes=10485760\n\nAlso increase the producer's max.request.size to match:\nProperties props = new Properties();\nprops.put(\"max.request.size\", 10485760);",
      "success_rate": 0.9,
      "how": "Increase the broker's max.message.bytes in server.properties and the topic's max.message.bytes if overridden:\n\n# server.properties\nmax.message.bytes=10485760  # 10 MB\n\n# Topic override\nalter topic my_topic --config max.message.bytes=10485760\n\nAlso increase the producer's max.request.size to match:\nProperties props = new Properties();\nprops.put(\"max.request.size\", 10485760);",
      "condition": "",
      "sources": []
    },
    {
      "action": "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.",
      "success_rate": 0.85,
      "how": "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.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Increase the broker's max.message.bytes in server.properties and the topic's max.message.bytes if overridden:\n\n# server.properties\nmax.message.bytes=10485760  # 10 MB\n\n# Topic override\nalter topic my_topic --config max.message.bytes=10485760\n\nAlso increase the producer's max.request.size to match:\nProperties props = new Properties();\nprops.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."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://kafka.apache.org/documentation/#max.message.bytes",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-01-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}