SECURITY WARNING: Never run commands you don't understand. Always review code before execution. Use at your own risk.
MessageQueue New Added 17 October 2026

RabbitMQ: ACCESS_REFUSED - Login was refused using authentication mechanism

The broker rejected the username and password, but the credentials are not always what is wrong. The default guest user is restricted to localhost, so guest/guest works on your machine and fails from another container or host. The other common causes are a user with no permissions on the virtual host, or a vhost path in the URL that does not exist.

Quick fix

Read the commands before running them. Anything that restarts a service, deletes data or changes permissions should be tried on a non-production system first.

Quick fix
# The broker log says which user and why
sudo journalctl -u rabbitmq-server | grep -i "access_refused\|invalid credentials" | tail

# List users and what each may do on each vhost
sudo rabbitmqctl list_users
sudo rabbitmqctl list_permissions -p /

# Create a real user instead of relying on guest
sudo rabbitmqctl add_user app "$(openssl rand -hex 16)"
sudo rabbitmqctl set_permissions -p / app ".*" ".*" ".*"

# The default vhost "/" must be URL-encoded in connection strings
# amqp://app:secret@rabbit:5672/%2F

# Check the credentials directly
sudo rabbitmqctl authenticate_user app "secret"

How to diagnose MessageQueue errors

Queue errors are usually about the balance between producers and consumers. Growing lag means consumers cannot keep up. Endless rebalancing usually means consumers are being evicted for exceeding a poll or heartbeat interval, not that the cluster is unhealthy. A poison message, one that always fails processing, will block an ordered partition forever unless there is a dead-letter path, which is why a DLQ is not optional in production.

If the quick fix above does not resolve it, work through these steps. They apply to this whole class of error, not just to this one message, which is usually what saves the time.

  1. Measure lag over time, not once: kafka-consumer-groups --describe --group <g>. The trend distinguishes a throughput problem from a stuck consumer.
  2. For repeated rebalancing, compare processing time per batch against max.poll.interval.ms. Slow processing looks exactly like a dead consumer to the coordinator.
  3. Always configure a dead-letter queue with a bounded retry count. Without one, a single malformed message stops the partition indefinitely.
  4. Check message size against the broker limit before assuming a network failure: SQS caps at 256 KB, Kafka at message.max.bytes.
  5. Verify consumer ACLs and topic authorisation separately from connectivity; an authorisation failure often surfaces as a metadata error.

Tools worth reaching for

  • kafka-consumer-groups
  • rabbitmqctl list_queues
  • aws sqs get-queue-attributes
  • kafkacat / kcat
  • flower (Celery)

Authoritative references

Primary documentation for this error, worth reading before applying any fix in production.

rabbitmq.com rabbitmq.com

Related MessageQueue errors

See all 20 MessageQueue errors →

Browse other categories

Something missing or wrong?

This entry is maintained by hand. If the fix is out of date, incomplete, or you have a better one, email a correction and it will be reviewed.