RabbitMQ Error Guide: 'frame_too_large' — Raise frame_max or Shrink the Message
Fix RabbitMQ frame_too_large errors: diagnose oversized messages and headers against the negotiated frame_max, align client and broker frame limits, and split big payloads.
- #rabbitmq
- #messaging
- #troubleshooting
- #errors
Stuck on this RabbitMQ error? Get the free incident triage checklist
A one-page PDF — the exact steps to isolate, fix, and verify a production error like this one. No spam, unsubscribe anytime.
Overview
Every AMQP 0-9-1 connection negotiates a maximum frame size (frame_max) during the handshake — the largest single protocol frame the broker and client agree to exchange. When a message body, its headers, or a single method frame exceeds that negotiated limit, RabbitMQ refuses it and closes the connection with a hard protocol error. The connection dies immediately; there is no partial delivery.
You will see it in the broker log as a connection closure:
=ERROR REPORT==== closing AMQP connection <0.1892.0> (10.0.5.44:52210 -> 10.0.4.21:5672):
{frame_too_large,141557,131072}
The two numbers are the offending frame size and the negotiated frame_max (here 141,557 bytes against a 131,072-byte limit). The client typically sees an abrupt drop, often surfaced as a hard protocol error:
amqp.exceptions.ConnectionClosed: (501, 'FRAME_ERROR - type 1, first 16 octets = ...: {frame_too_large ...}')
This is not the same as a message-size policy rejection (max-message-size) — frame_too_large is a low-level protocol violation caught before the message is ever accepted onto a queue.
Symptoms
- A connection dies the instant a large message is published; small messages on the same code path work fine.
- Broker log shows
{frame_too_large, <actual>, <limit>}with two byte counts. - Clients see
FRAME_ERROR/ConnectionClosed(501) rather than abasic.nackor channel-level error. - The failure is deterministic and size-dependent — it reproduces every time for messages above a threshold.
sudo grep -i 'frame_too_large' /var/log/rabbitmq/rabbit@$(hostname -s).log | tail -5
=ERROR REPORT==== closing AMQP connection (10.0.5.44:52210 -> 10.0.4.21:5672): {frame_too_large,141557,131072}
Common Root Causes
1. A message body larger than the negotiated frame_max
The most common cause: an oversized payload (a base64 blob, an embedded file, a fat JSON document) exceeds the per-frame limit. The body must fit within frame_max minus protocol overhead.
rabbitmqctl list_connections name frame_max | sort -k2 -n | head
10.0.5.44:52210 131072
A 131,072-byte frame_max cannot carry a ~140 KB message; the body frame alone is too large.
2. Client and broker frame_max are mismatched or the client’s is too small
frame_max is negotiated to the lower of the two sides. A client library configured with a small frame_max (or an old default) caps the connection even when the broker allows more.
rabbitmqctl list_connections name client_properties frame_max | grep 10.0.5.44
10.0.5.44:52210 [{"product","pika"},...] 131072
If the broker’s frame_max is 512 KB but the connection shows 131072, the client requested the smaller value.
3. Oversized headers, not the body
AMQP headers (a large x- header map, a huge reply_to, verbose tracing metadata) count toward the frame. A modest body with bloated headers can still trip the limit.
4. The broker’s frame_max was lowered below what clients send
An operator set a small frame_max in rabbitmq.conf for memory reasons, unaware that some publishers send larger single frames.
rabbitmqctl environment | grep -i frame_max
{frame_max,131072}
5. A protocol/framing bug or wrong port
A non-AMQP client (or an AMQP client pointed at the wrong port, e.g., the management port) can send bytes that the broker misreads as an enormous frame, producing frame_too_large or a related FRAME_ERROR.
Diagnostic Workflow
Step 1: Confirm the error and read both numbers
sudo grep -i 'frame_too_large' \
/var/log/rabbitmq/rabbit@$(hostname -s).log | tail -10
The tuple {frame_too_large, ACTUAL, LIMIT} tells you exactly how far over you are. If ACTUAL is only slightly above LIMIT, headers may be the culprit; if it’s far over, it’s the body.
Step 2: Read the negotiated frame_max per connection
rabbitmqctl list_connections name peer_host frame_max state | sort
A connection showing a smaller frame_max than the broker default means the client negotiated it down.
Step 3: Check the broker’s configured limit
rabbitmqctl environment | grep -i frame_max
Compare this to what publishers need. If the broker limit is lower than a legitimate message size, that’s the constraint.
Step 4: Measure the actual message size
Instrument the publisher (or inspect the payload) to confirm the real body + header size. Base64 encoding inflates binary by ~33%, which surprises people who sized against the raw bytes.
Step 5: Decide raise-limit vs shrink-message
If large messages are legitimate and bounded, raise frame_max on both sides to a value comfortably above the largest frame. If messages are unbounded or huge, the right fix is to stop putting big blobs on the broker — store them elsewhere and publish a reference.
# after adjusting rabbitmq.conf and reconnecting clients, verify the new value
rabbitmqctl list_connections name frame_max | sort -k2 -n | tail
Example Root Cause Analysis
A document-processing service starts failing intermittently after a feature that embeds thumbnail images as base64 in the message body. The broker log shows repeated closures:
=ERROR REPORT==== closing AMQP connection (10.0.5.44:52210 -> 10.0.4.21:5672): {frame_too_large,141557,131072}
The team assumes a network issue, but the failures correlate exactly with documents that have thumbnails. Checking the connection:
rabbitmqctl list_connections name frame_max client_properties | grep 10.0.5.44
10.0.5.44:52210 131072 [{"product","pika"},{"version","1.3.2"},...]
The negotiated frame_max is 131,072 bytes (the client’s default), while the raw ~105 KB thumbnail becomes ~140 KB after base64 encoding — over the limit. The broker rejects the single body frame and drops the connection.
Rather than raise frame_max to accommodate arbitrarily large images, the team moves thumbnails to object storage and publishes only a URL and checksum in the message:
# message body shrinks from ~140 KB to under 1 KB
{"doc_id":"...","thumbnail_url":"s3://bucket/thumbs/...","sha256":"..."}
After deploying, the frame_too_large closures stop and the broker carries far less data. The real fix was keeping large binaries off the message bus, not enlarging the frame.
Prevention Best Practices
- Keep message bodies small — publish references (URLs, IDs) to large payloads stored in object storage rather than embedding blobs on the broker.
- Remember base64 inflates binary by ~33%; size limits against the encoded length, not the raw bytes.
- Set an explicit, aligned
frame_maxon both broker and clients so negotiation is predictable, and document the intended maximum message size. - Enforce a
max-message-sizepolicy so oversized messages fail with a clear, catchable error instead of surprising you as a frame violation. - Watch header bloat — trim verbose or debug headers before publishing; they count toward the frame.
- Alert on
frame_too_largelog lines so a new oversized-payload code path is caught in staging, not production. The free incident assistant can correlate the closure with the offending connection’sframe_max. More in the RabbitMQ guides.
Quick Command Reference
# Confirm frame_too_large closures and read actual vs limit
sudo grep -i 'frame_too_large' /var/log/rabbitmq/rabbit@$(hostname -s).log | tail -10
# Negotiated frame_max per connection
rabbitmqctl list_connections name peer_host frame_max state | sort
# Broker's configured frame_max
rabbitmqctl environment | grep -i frame_max
# Identify the client library that negotiated a small frame_max
rabbitmqctl list_connections name frame_max client_properties | sort -k2 -n | head
# Verify a new frame_max after reconnecting clients
rabbitmqctl list_connections name frame_max | sort -k2 -n | tail
Conclusion
A frame_too_large closure means a single AMQP frame — body, headers, or a method — exceeded the connection’s negotiated frame_max, and the broker dropped the connection rather than accept it. The tuple {frame_too_large, ACTUAL, LIMIT} tells you exactly how far over you are. The usual root causes:
- A message body larger than the negotiated frame_max (often base64-inflated).
- A client that negotiated a smaller
frame_maxthan the broker allows. - Oversized headers rather than the body.
- A broker
frame_maxset lower than legitimate publishers need. - A non-AMQP client or wrong-port connection misread as a giant frame.
Read both numbers from the log, compare the negotiated frame_max across connections, then decide between raising the aligned limit for bounded large messages or — better for unbounded blobs — moving the payload off the broker and publishing a reference.
Fixed it? Get 500 RabbitMQ & DevOps AI prompts — free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.
Did this fix your issue?
Get 500 Battle-Tested DevOps AI Prompts — Free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.