Warren
Pitfalls

Six more ways RabbitMQ drops a message without an error (measured on 4.3.6)

2026-11-13 · 5 min read · Viktor Baumann

The first six traps were about acks, prefetch and durability. These six are about routing and queue lifecycle: places where RabbitMQ does exactly what it was told, confirms the publish, and the message is not there afterwards. Every example ran against a throwaway RabbitMQ 4.3.6 with Python and pika; the output is what the script printed.

1. The producer started first

The billing service is deployed before the invoice consumer. The exchange billing exists, the queue does not yet. Five invoices go out with publisher confirms on, then the consumer starts and declares its queue:

published 5 invoice(s) to billing, all confirmed
billing.invoices declared and bound to invoice.#
billing.invoices  holds 0 message(s)

An exchange stores nothing. A message that matches no binding at the moment it is published is dropped, and the broker still confirms it, because a confirm only says the broker took responsibility for the message. The sixth invoice, sent after the consumer started, arrives as expected.

Fix: declare the queue and its binding in the producer too (declaring is idempotent), or ship them as broker definitions so they exist before any service starts. Publishing with mandatory=True turns the silent drop into a returned message the producer can see.

2. One deploy deleted the queue and its jobs

A worker consumes a durable queue declared with auto_delete=True. Ten report jobs arrive while it works on the first, then the worker restarts for a deploy:

worker consumes report.jobs (durable, auto_delete=True)
10 report jobs published and confirmed, the worker is busy with the first
worker stops for a deploy
report.jobs       does not exist

auto_delete deletes the queue when its last consumer goes away, with everything in it. durable does not protect against that; it only decides whether the queue survives a broker restart. The same deploy with a queue declared without auto_delete:

worker consumes report.jobs (durable, no auto_delete)
10 report jobs published and confirmed, the worker is busy with the first
worker stops for a deploy
report.jobs       holds 10 message(s)

A side finding: RabbitMQ 4.3 no longer lets you declare a non-durable, non-exclusive queue at all. The declare closes the connection with Feature transient_nonexcl_queues is deprecated, so code that relied on transient shared queues fails at startup after an upgrade.

Fix: work queues are durable and never auto_delete. Keep auto_delete and exclusive for per-consumer queues whose messages nobody needs after the consumer is gone.

3. You rejected it, RabbitMQ deleted it

A payment with an invalid IBAN. The consumer rejects it with requeue=False, expecting it to land in a dead-letter queue:

payment-7301: invalid IBAN, basic_reject(requeue=False)
pay.q             holds 0 message(s)

Without a dead-letter exchange on the queue, a reject (or nack) without requeue discards the message. No error, no log line. With x-dead-letter-exchange on the queue, the same reject:

payment-7301: invalid IBAN, basic_reject(requeue=False)
pay.q             holds 0 message(s)
pay.dlq           holds 1 message(s)

Fix: give every work queue a dead-letter exchange. For queues that already exist, a policy adds it without redeclaring them, and it also applies to the messages already in the queue.

4. "Published 10, no error", five never arrived

A queue with x-max-length 5 and x-overflow reject-publish, its consumer down. A publisher without confirms sends ten orders:

published 10, no error
ovf.q             holds 5 message(s)

reject-publish is the overflow mode people pick so that nothing is dropped silently. But the refusal travels as a negative publisher confirm, and a publisher that never called confirm_delivery() never hears it. With confirms on:

published 10: 5 confirmed, 5 NACKED by the broker
ovf.q             holds 5 message(s)

Now the publisher knows which five to keep and retry.

Fix: reject-publish only helps together with publisher confirms and code that handles a nack. Without confirms, the default drop-head and reject-publish lose the same number of messages; one drops the oldest, the other the newest.

5. orders.* does not match orders.eu.created

A queue bound to a topic exchange with orders.*. The EU team adds a region to the routing key:

publish order-7501 with key orders.eu.created: confirmed
eu.orders         holds 0 message(s)

In a topic binding * stands for exactly one word and # for zero or more. orders.eu.created has three words, so orders.* does not match, and the message is dropped, confirmed. Bound with orders.#:

publish order-7501 with key orders.eu.created: confirmed
eu.orders         holds 1 message(s)

Fix: use # where the number of words can grow, or orders.*.created if you only want the created events. Publish with mandatory=True to hear about keys nobody binds.

6. One missing header, and the message goes nowhere

A headers exchange; print.q is bound with format=pdf and region=eu, without x-match. A document arrives with format=pdf but no region:

publish doc-7601 with headers format=pdf: confirmed
print.q           holds 0 message(s)

A headers binding without x-match means x-match: all: every header in the binding has to be in the message. With both headers it arrives:

publish doc-7601 with headers format=pdf, region=eu: confirmed
print.q           holds 1 message(s)

With x-match: any on the binding, format=pdf alone is enough.

Fix: set x-match explicitly so the next reader knows which one you meant, and publish with mandatory=True.

Checklist

The first six traps, from auto_ack to transient messages, are in Six ways RabbitMQ loses a message without an error. Twelve more, as one video (6:52, captions, no sound needed):

Watch it on YouTube →

Traps 1, 5 and 6 show in a definitions export: the routing tester tells you which routing keys and headers reach no queue, and the topology diagram draws every dead-letter path, so a work queue without one, the setup behind trap 3, stands out. The policy generator writes the policy that adds the dead-letter exchange. All three run in your browser.