When an ApsaraMQ for RabbitMQ client calls an AMQP 0-9-1 method, the broker returns a reply code and reply text to indicate success or failure. Use the following tables to identify the root cause of an error and apply the recommended fix.
How to read an error response
Each error response contains the following fields:
| Field | Description | Example |
|---|---|---|
reply-code | The numeric error code. | 404 |
reply-text | The error identifier. | ExchangeNotExist |
ReqId | A unique request ID for tracking. | 5FB4C999314635F952FCBFF6 |
ErrorHelp | Troubleshooting metadata, including related resource names and a link to this reference. | [dstQueue=XXX_test_queue,srcExchange=Producer.ExchangeName,routingKey=XXX_test_bk,http://mrw.so/6rNqO8] |
class-id | The AMQP class ID. Matches open-source RabbitMQ. | 50 |
method-id | The AMQP method ID. Matches open-source RabbitMQ. | 20 |
When a basicPublish call fails, ErrorHelp returns only the msgId to reduce performance overhead. The key-value structure is not included. Use the msgId to trace the failed publish.
Sample stack trace
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>
(reply-code=404, reply-text=ExchangeNotExist, ReqId:5FB4C999314635F952FCBFF6, ErrorHelp[dstQueue=XXX_test_queue,
srcExchange=Producer.ExchangeName,routingKey=XXX_test_bk, http://mrw.so/6rNqO8], class-id=50, method-id=20)
at com.rabbitmq.client.impl.ChannelN.asyncShutdown(ChannelN.java:516)
at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:346)
at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:182)
at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:114)
at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:672)
at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:48)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:599)
at java.lang.Thread.run(Thread.java:748)Error severity
ApsaraMQ for RabbitMQ errors fall into two categories:
Channel-level (soft) errors close only the affected channel. The connection stays open, and you can open a new channel to retry. Most errors in the tables below are channel-level.
Connection-level (hard) errors close the entire connection. All channels on that connection are lost. Errors such as
320 ProtocolVersionMismatchand541 InternalErrorare connection-level.
Protocol and authentication errors
| Reply code | Reply text | Description | Solution |
|---|---|---|---|
| 320 | ProtocolVersionMismatch | The client uses an unsupported protocol version. Only AMQP 0-9-1 is supported. | Use the AMQP 0-9-1 protocol. |
| 403 | AccessDeniedByRamPolicy | The RAM user does not have the required permissions. | Grant the required permissions to the RAM user. For details, see RAM access policies. |
| 530 | AccessAccountDataError | Authentication failed with the provided username and password. | Make sure that:
|
Resource not found errors
These errors occur when a basicPublish, BasicConsume, bind, or declare operation references a resource that does not exist.
| Reply code | Reply text | Description | Solution |
|---|---|---|---|
| 200 | no route has mandatory | The basicPublish method was called with mandatory set to true, but the exchange found no matching queue for the routing key. The broker returned the message to the producer through basic.return. | Check the exchange bindings. Make sure that a queue is bound with a routing key that matches the published message. |
| 404 | ExchangeNotExist | The specified exchange does not exist. |
|
| 404 | QueueNotExist | The specified queue does not exist. |
|
Declaration and validation errors
These errors occur when you declare or bind exchanges and queues, typically due to invalid names or property mismatches.
| Reply code | Reply text | Description | Solution |
|---|---|---|---|
| 405 | QueueExclusive | The queue is exclusive to the connection that created it. | Access the queue only from its declaring connection. Other connections cannot consume from or declare an exclusive queue. |
| 406 | ExchangeNameEmpty | No exchange name was provided. | Specify a non-empty exchange name. For naming requirements, see Limits. |
| 406 | ExchangeInBuilt | Exchanges with names starting with amq. are reserved by the system. | Choose a different exchange name that does not start with amq.. |
| 406 | QueueNameInvalid | The queue name contains invalid characters or exceeds length limits. | Fix the queue name. For naming requirements, see Limits. |
| 406 | QueueConsumerNameInvalid | The consumer name contains invalid characters or exceeds length limits. | Fix the consumer name. For naming requirements, see Limits. |
| 406 | BindingNameInvalid | The routing key contains invalid characters or exceeds length limits. | Fix the routing key. For naming requirements, see Limits. |
| 406 | QueueHasDiffField | The properties in the queue declaration do not match the existing queue on the server. | Update the declaration parameters to match the existing queue properties. For details, see QueueHasDiffField. |
| 530 | ExchangeHasDiffFields | The properties in the exchange declaration do not match the existing exchange on the server. | Update the declaration parameters to match the existing exchange properties. For details, see ExchangeHasDiffFields. |
Message errors
| Reply code | Reply text | Description | Solution |
|---|---|---|---|
| 311 | MessageBodyLengthExceeded | The message body exceeds the maximum allowed size. | Reduce the message size. For size limits, see Limits. |
| 406 | MessageBodyEmpty | The message body is empty. | Include content in the message body. |
Delayed message exchange errors
| Reply code | Reply text | Description | Solution |
|---|---|---|---|
| 503 | ExchangeTypeNotSupport[x-delayed-message] | The x-delayed-message exchange was declared with incorrect parameters. | Set the exchange type to x-delayed-message and specify a valid x-delayed-type argument. Example: arguments.put("x-delayed-type", "The value can only be direct, topic, fanout, or headers");channel.exchangeDeclare("${exchangeName}", "The value can only be x-delayed-message", true, false, arguments); |
Channel and connection errors
| Reply code | Reply text | Description | Solution |
|---|---|---|---|
| 504 | ChannelNotFind | The channel was released while a message was in transit. This typically happens when multiple threads share a connection and frequently open and close connections. | If you use Spring Boot with the connection factory in CONNECTION mode, increase spring.rabbitmq.cache.connection.size to reduce the rate of connection churn. |
| 530 | ChannelNumExceeded | The number of channels on a single connection exceeds the limit. | Close unused producer or consumer channels. |
| 530 | ConnectionNumExceeded | The number of connections on a single instance exceeds the limit. |
|
| 530 | QueueConsumerAlreadyExist | A consumer with the same consumer tag already exists on the queue. | Specify a unique ConsumerTag value when you call BasicConsume on the same channel. |
Resource quota errors
These errors occur when an instance, vhost, or resource reaches its quota. To raise quotas, upgrade the instance configuration. For default limits, see Limits.
| Reply code | Reply text | Description | Solution |
|---|---|---|---|
| 530 | denied for too many requests | The peak TPS for sending or receiving messages exceeds the instance limit. The request is throttled. |
|
| 530 | VhostNumExceeded | The number of vhosts in the instance exceeds the limit. |
|
| 530 | ExchangeNumExceeded | The number of exchanges in a single vhost exceeds the limit. |
|
| 530 | QueueNumExceeded | The number of queues in the instance exceeds the limit. |
|
| 530 | VHostTotalBindingNumExceeded | The number of bindings in a single vhost exceeds the limit. |
|
| 530 | ExchangeBindingNumExceeded | The number of queues bound to a single exchange exceeds the limit. | Remove unused queue bindings from the exchange. |
| 530 | QueueConsumerNumExceeded | The number of consumers on a single queue exceeds the limit. |
|
Internal errors
| Reply code | Reply text | Description | Solution |
|---|---|---|---|
| 541 | InternalError | An internal server error occurred. | Check the reply-text for details and submit a ticket to contact ApsaraMQ for RabbitMQ technical support. |