Skip to content
Latchkey

RabbitMQ "ACCESS_REFUSED - vhost not found" in CI

The connection asked for a virtual host the broker does not have, or that the user has no permission to use. RabbitMQ refuses the connection at the vhost check, before any channel opens.

What this error means

The connection fails with "ACCESS_REFUSED - vhost 'app' not found" or "not allowed to access vhost".

Terminal
ACCESS_REFUSED - vhost 'app' not found

Common causes

The vhost was never created

The connection URL references a vhost like "app" that no setup step created on the test broker.

The user has no permission on the vhost

The vhost exists but the connecting user was never granted access to it.

How to fix it

Create the vhost and grant permissions

Create the vhost and give the user full permissions in a setup step.

Terminal
rabbitmqctl add_vhost app
rabbitmqctl set_permissions -p app app ".*" ".*" ".*"

Use the default vhost if you do not need a custom one

Connect to the default vhost "/" (URL-encoded as %2F) when no dedicated vhost is required.

Terminal
AMQP_URL=amqp://app:app_pw@localhost:5672/%2F

How to prevent it

  • Create custom vhosts and grant permissions in a setup step.
  • URL-encode the default vhost "/" as %2F in connection URLs.
  • Keep the vhost in the URL aligned with what the broker has.

Frequently asked questions

What causes "RabbitMQ vhost not found"?
The connection URL references a vhost like "app" that no setup step created on the test broker.
How do I fix RabbitMQ vhost not found?
Create the vhost and give the user full permissions in a setup step.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card