When an API request to Simple Message Queue (formerly MNS) fails, the service returns an HTTP error status code (3xx, 4xx, or 5xx) and an XML or text response body that contains the error details. This topic describes the error response format and lists all error codes with their recommended solutions.
Error response format
An error response has the following XML structure:
<?xml version="1.0" encoding="UTF-8"?>
<Error xmlns="http://mns.aliyuncs.com/doc/v1/">
<Code>InvalidArgument</Code>
<Message>Authorization header is invalid or missing.</Message>
<RequestId>04bb60e3-28aa-4706-99b0-9345d834****</RequestId>
<HostId>mns.cn-hangzhou.aliyuncs.com</HostId>
</Error>
The following table describes each element in the error response body.
| Element | Description |
|---|
| Code | The error code that identifies the type of error. |
| Message | A detailed error message. |
| RequestId | The unique ID of the request. Provide this ID when you contact technical support. |
| HostId | The endpoint of the Simple Message Queue (formerly MNS) instance that processed the request. |
For operation-specific errors, see the API documentation for the corresponding operation.
Error code list
The following tables list the error codes grouped by category. Each entry includes the HTTP status code, error code, error message returned by the API, and the recommended solution.
Authentication and authorization errors
| HTTP status code | Error code | Error message | Recommended solution |
|---|
| 400 | InvalidAuthorizationHeader | The Authorization header format is invalid. | The Authorization header is incorrectly formatted. Verify that your AccessKey ID and AccessKey secret are valid. |
| 400 | MissingAuthorizationHeader | Authorization header is required. | The Authorization header is missing. Add the required header to your request. For more information, see Common parameters. |
| 400 | InvalidDateHeader | The Date header format is invalid. | The Date header is incorrectly formatted. For more information, see Common parameters. |
| 400 | MissingDateHeader | Date header is required. | The Date header is missing. Add the required header to your request. For more information, see Common parameters. |
| 400 | InvalidDegist | The Content-MD5 you specified is invalid. | The Content-MD5 header value is invalid. Recalculate and set the correct Content-MD5 value. |
| 403 | AccessDenied | The OwnerId that your Access Key Id associated to is forbidden for this operation. | The account associated with the AccessKey ID does not have permission for this operation. Verify that you are using the correct AccessKey ID and that the account has the required permissions. |
| 403 | InvalidAccessKeyId | The AccessKey Id you provided is not exist. | The specified AccessKey ID does not exist. Verify that the AccessKey ID is correct. |
| 403 | SignatureDoesNotMatch | The request signature we calculated does not match the signature you provided. Check your key and signing method. | The request signature is invalid. Check your AccessKey secret and signing method. For more information, see Sign requests. |
| 408 | TimeExpired | The http request you sent is expired. | The time difference between the client and the server exceeds 15 minutes. Synchronize your local system clock. |
Request validation errors
| HTTP status code | Error code | Error message | Recommended solution |
|---|
| 400 | InvalidRequestURL | Http request URL format invalid. | The request URL format is invalid. Check the URL against the API documentation. |
| 400 | InvalidQueryString | Http request URL contains invalid querystring item "{QueryString}". | The request URL contains an invalid query string parameter. Remove or correct the invalid parameter. |
| 400 | MalformedXML | The XML you provided was not well-formed. | The XML request body is malformed. Validate the XML syntax before sending the request. |
| 400 | InvalidArgument | The length of message should not be larger than MaximumMessageSize. | The message body exceeds the maximum allowed size. Reduce the message size or increase the MaximumMessageSize of the queue. |
| 400 | InvalidArgument | A subscription's MaximumMessageSize should be greater than the topic's MaximumMessageSize! | The subscription's MaximumMessageSize must be greater than or equal to the topic's MaximumMessageSize. Increase the subscription's MaximumMessageSize value. |
| 400 | InvalidArgument | The XML you provided did not validate against our published schema, cause by {Parameter}. | The XML request body does not conform to the expected schema. Check the specified parameter and correct the XML structure. |
| 400 | InvalidArgument | The value of {Parameter} should between {Min} and {Max} seconds/bytes. | A parameter value is out of range. Set the parameter value within the specified range. |
Note: In the error messages above, {Parameter} represents a parameter in the XML request body, {Min} and {Max} represent the minimum and maximum allowed values, and {QueryString} represents a query string parameter in the request URL.
Resource naming errors
| HTTP status code | Error code | Error message | Recommended solution |
|---|
| 400 | InvalidQueueName | The queue name you provided is invalid. QueueName should start with alpha and contain only alpha, digit or -. | The queue name must start with a letter and contain only letters, digits, and hyphens (-). |
| 400 | QueueNameLengthError | Queue name length should between 1 and 255. | The queue name must be 1 to 255 characters in length. |
| 400 | TopicNameInvalid | The topic name you provided is invalid. TopicName should start with alpha or digit and contain only alpha, digit or -. | The topic name must start with a letter or digit and contain only letters, digits, and hyphens (-). |
| 400 | TopicNameLengthError | Topic name length is out of range, should be between 1 and 255. | The topic name must be 1 to 255 characters in length. |
| 400 | SubscriptionNameInvalid | The subscription name you provided is invalid. SubscriptionName should start with alpha or digit and contain only alpha, digit or -. | The subscription name must start with a letter or digit and contain only letters, digits, and hyphens (-). |
| 400 | SubscriptionNameLengthError | Subscription name length is out of range, should be between 1 and 255. | The subscription name must be 1 to 255 characters in length. |
| 400 | EndpointInvalid | The format of endpoint you provided is invalid. | The endpoint format is invalid. For more information, see Endpoint. |
Message and receipt handle errors
| HTTP status code | Error code | Error message | Recommended solution |
|---|
| 400 | MissingReceiptHandle | ReceiptHandle is required. | Include the ReceiptHandle parameter in your request. |
| 400 | MissingVisibilityTimeout | VisibilityTimeout is required. | Include the VisibilityTimeout parameter in your request. |
| 400 | ReceiptHandleError | The receipt handle you provide is not valid. | The receipt handle is invalid. Use a valid receipt handle obtained from a ReceiveMessage operation. |
| 404 | MessageNotExist | Message not exist. | No messages are available in the queue. The queue is empty or all messages are currently invisible. |
| 404 | MessageNotExist | The receipt handle you provided has expired. | The receipt handle has expired because the message was not processed within the visibility timeout period. Process messages within the visibility timeout period, or increase the visibility timeout value. |
Resource not found and conflict errors
| HTTP status code | Error code | Error message | Recommended solution |
|---|
| 404 | QueueNotExist | The queue name you provided does not exist. | The specified queue does not exist. Create the queue before performing this operation. |
| 404 | TopicNotExist | The topic name you provided does not exist. | The specified topic does not exist. Create the topic before performing this operation. |
| 404 | SubscriptionNotExist | The subscription you provided does not exist. | The specified subscription does not exist. Create the subscription before performing this operation. |
| 409 | QueueAlreadyExist | The queue you want to create is already exist. | A queue with the same name already exists with different attributes. Use a different name or ensure the attributes match the existing queue. |
| 409 | TopicAlreadyExist | The topic you want to create already exists. | A topic with the same name already exists with different attributes. Use a different name or ensure the attributes match the existing topic. |
| 409 | SubscriptionAlreadyExist | The subscription you want to create already exists. | A subscription with the same name already exists with different attributes. Use a different name or ensure the attributes match the existing subscription. |
Throttling errors
| HTTP status code | Error code | Error message | Recommended solution |
|---|
| 400 | QpsLimitExceeded | The qps limit of the queue is exceeded. | The number of queries per second (QPS) exceeds the limit. Reduce the request rate or contact technical support to increase the QPS limit. |
| 429 | TooManyRequests | The request is denied by cluster flow limiter for too many requests. | The request is throttled at the cluster level. Implement exponential backoff and retry the request. For more information, see Throttling policy. |
Server errors
| HTTP status code | Error code | Error message | Recommended solution |
|---|
| 500 | InternalError | Interal error. | An internal server error occurred. Retry the request with exponential backoff. If the error persists, contact technical support and provide the RequestId from the response. |
| 500 | InternalServerError | Interal error. | An internal server error occurred. Retry the request with exponential backoff. If the error persists, contact technical support and provide the RequestId from the response. |