Skip to content
Latchkey

RabbitMQ "PRECONDITION_FAILED - inequivalent arg durable" in CI

A queue or exchange was declared with arguments that do not match an existing one of the same name. RabbitMQ will not silently change a declared entity, so it closes the channel with PRECONDITION_FAILED. The classic case is redeclaring a queue as durable=false when it already exists as durable=true.

What this error means

A declare fails with "PRECONDITION_FAILED - inequivalent arg 'durable' for queue 'tasks' in vhost '/': received 'false' but current is 'true'".

Terminal
operation queue.declare caused a channel exception precondition_failed:
inequivalent arg 'durable' for queue 'tasks' in vhost '/': received 'false' but current is 'true'

Common causes

Redeclare with mismatched durability or arguments

A second declare of the same queue uses different durable, auto-delete, or x-arguments than the existing one.

A leftover queue from an earlier run

A queue persisted across CI runs with different settings, so a fresh declare with new arguments conflicts.

How to fix it

Declare with consistent arguments everywhere

Use the same durability and arguments in every place that declares the queue.

Terminal
# every declarer must agree on durable
channel.queue_declare(queue="tasks", durable=True)

Start from a clean broker per run

Use a fresh RabbitMQ service container each CI run so no stale queue with old arguments survives.

  1. Run RabbitMQ as an ephemeral service container, not a persisted volume.
  2. Delete the conflicting queue if you must reuse a broker.
  3. Align declare arguments across producers and consumers.

How to prevent it

  • Agree on durability and arguments across all declarers.
  • Use an ephemeral broker per CI run to avoid stale topology.
  • Delete and recreate a queue only when arguments must change.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →