Question: I plan on storing stacktraces in the RabbitMQ message header. Do message headers have a size limit?

Answer: 
> 
> The answers so far seem to indicate that it would be no problem to cram a stacktrace in a header.
> 
> 
> 

As John insinuates in his answer previously, some changes were made a couple of years a go that will cause an `IllegalArgumentException` to be thrown when the header size exceeds `frame_max` (by default this is indeed 128kB).

[(The source code I'm referring to can be found here!)](https://github.com/rabbitmq/rabbitmq-java-client/blob/283902d3ed7e42098b60cbbf95154aa93a741dbd/src/main/java/com/rabbitmq/client/impl/AMQCommand.java#L113)

As a (fun) side note, this was done to prevent an issue whereby messages that had single huge header that exceeded max frame size would result in the client creating and transmitting the huge header frame to server and, as a result, the server shuts the connection down with `frame_too_large` error and that breaks all open channels!

In order to include a stacktrace in a header, you *could* increase the header size, or set it to `0` for 'unlimited', but you should be aware that this isn't particularly advisable in most situations (larger values may improve throughput while smaller values may improve latency).
The answers so far seem to indicate that it would be no problem to cram a stacktrace in a header. However, I actually tried this, and ran into this problem:

```
Caused by: java.lang.IllegalArgumentException: Content headers exceeded max frame size: 163475 > 131072
    at com.rabbitmq.client.impl.AMQCommand.transmit(AMQCommand.java:115) ~[amqp-client-5.7.3.jar:5.7.3]

```

Seems to me that there somewhere is a 128kB limit being enforced (by default).