Warren
Error

RESOURCE_LOCKED - cannot obtain exclusive access to locked queue: exclusive queues in RabbitMQ

2026-10-19 · 2 min read · Viktor Baumann

RESOURCE_LOCKED - cannot obtain exclusive access to locked queue 'replies' in vhost 'orders'.
It could be originally declared on another connection or the exclusive property value does not
match that of the original declaration.

An exclusive queue belongs to the connection that declared it. Any other connection that tries to use it gets this error. Here is what is refused, what is not, and the part that costs messages, measured on RabbitMQ 4.3.6.

What another connection can and cannot do

From a second connectionResult
passive declareRESOURCE_LOCKED
basic_consumeRESOURCE_LOCKED
publish to the queueallowed; the message arrives

So a second instance of a service that declares the same exclusive queue name fails on start-up, while publishers elsewhere keep sending to it without noticing anything.

The part that costs messages

When the owning connection closes, the queue is deleted, with everything in it. In our test the queue held a message published from another connection; after the owner disconnected, a passive declare answered NOT_FOUND - no queue. A restart, a network blip or a pod rescheduled is enough.

Exclusive queues are made for state that may disappear: RPC reply queues, temporary subscriptions. For work that must survive the consumer, use a durable, non-exclusive queue. If you only want one consumer at a time, use a single active consumer (x-single-active-consumer) instead.

The related error: exclusive consumers

A normal queue with an exclusive consumer refuses a second consumer with a different code:

ACCESS_REFUSED - queue 'orders.work' in vhost 'orders' in exclusive use

Here the queue survives when the consumer goes; only the consumption is exclusive.