当您访问轻量消息队列(原 MNS)出错时,轻量消息队列(原 MNS)会返回一个合适的3xx、4xx或5xx的HTTP状态码,以及一个text或xml格式的消息体。本文介绍轻量消息队列(原 MNS)错误码消息体说明及列表。
错误码说明
错误响应的消息体示例:
    <?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>       所有错误的消息体中都包括以下元素:
- Code:错误码。 
- Message:详细错误信息。 
- RequestId:唯一标识该次请求的编号。 - 当您无法解决问题时,可以提供RequestId寻求技术支持工程师的帮助。 
- HostId:标识请求访问的地域。 
其他特殊的错误信息元素请参见每个请求的具体介绍。
错误码列表
错误响应中错误码的错误描述和建议处理方式,请参见下表。
| HTTP状态码 | 错误码 | 错误描述 | 建议处理方式 | 
| 400 | InvalidAuthorizationHeader | The Authorization header format is invalid. | 鉴权信息错误,请检查AccessKey ID和AccessKey Secret配置是否有误。 | 
| InvalidDateHeader | The Date header format is invalid. | Date字段不合法。具体信息,请参见公共参数。 | |
| InvalidDegist | The Content-MD5 you specified is invalid. | 请求Header中Content-MD5不正确。 | |
| InvalidRequestURL | Http request URL format invalid. | 请求的URL不正确。具体信息,请参见对应API文档。 | |
| InvalidQueryString | Http request URL contains invalid querystring item “Element⑤”. | 请求的URL不正确。具体信息,请参见对应API文档。 | |
| MalformedXML | The XML you provided was not well-formed. | XML结构异常。具体信息,请参见对应API文档。 | |
| MissingAuthorizationHeader | Authorization header is required. | 请求Header缺少字段。具体信息,请参见公共参数。 | |
| MissingDateHeader | Date header is required. | 请求Header缺少字段。具体信息,请参见公共参数。 | |
| MissingReceiptHandle | ReceiptHandle is required. | 请求缺少参数。具体信息,请参见对应API文档。 | |
| MissingVisibilityTimeout | VisibilityTimeout is required. | 请求缺少参数。具体信息,请参见对应API文档。 | |
| InvalidQueueName | The queue name you provided is invalid. QueueName should start with alpha and contain only alpha, digit or - . | 队列名称不合法。具体信息,请参见对应API文档。 | |
| QueueNameLengthError | Queue name length should between 1 and 255. | 队列名称不合法。具体信息,请参见对应API文档。 | |
| ReceiptHandleError | The receipt handle you provide is not valid. | 请求参数不合法。具体信息,请参见对应API文档。 | |
| QpsLimitExceeded | The qps limit of the queue is exceeded. | 队列每秒的请求次数超过QPS限制,如果需要提高QPS限制,请联系轻量消息队列(原 MNS)技术支持。 | |
| TopicNameInvalid | The topic name you provided is invalid. TopicName should start with alpha or digit and contain only alpha, digit or -. | 主题名称不合法。具体信息,请参见对应API文档。 | |
| TopicNameLengthError | Topic name length is out of range, should be between 1 and 255. | 主题名称不合法。具体信息,请参见对应API文档。 | |
| SubscriptionNameInvalid | The subscription name you provided is invalid. SubscriptionName should start with alpha or digit and contain only alpha, digit or -. | 订阅名称不合法。具体信息,请参见对应API文档。 | |
| SubscriptionNameLengthError | Subscription name length is out of range, should be between 1 and 255. | 订阅名称不合法。具体信息,请参见对应API文档。 | |
| EndpointInvalid | The format of endpoint you provided is invalid. | Endpoint参数不合法。具体信息,请参见Endpoint。 | |
| InvalidArgument | The length of message should not be larger than MaximumMessageSize. | 消息体过长。具体信息,请参见对应API文档。 | |
| A subscription's MaximumMessageSize should be greater than the topic's MaximumMessageSize! | 修改队列的消息大小,使其大于或等于主题的消息大小。 | ||
| The XML you provided did not validate against our published schema, cause by Element①. | XML结构不正确。具体信息,请参见对应API文档。 | ||
| The value of Element②should between Low③ and High④ seconds/bytes. | 参数值非法,请根据提示调整。 | ||
| 403 | AccessDenied | The OwnerId that your Access Key Id associated to is forbidden for this operation. | 检查AccessKey ID和AccessKey Secret等配置是否正确。 | 
| InvalidAccessKeyId | The AccessKey Id you provided is not exist. | 检查AccessKey ID是否正确。 | |
| SignatureDoesNotMatch | The request signature we calculated does not match the signature you provided. Check your key and signing method. | 请求签名异常。具体信息,请参见请求签名机制。 | |
| 404 | MessageNotExist | Message not exist. | 队列中没有可见消息。 | 
| The receipt handle you provided has expired. | 消费消息过慢导致消息重新回到队列生成新的ReceiptHandle,之前的ReceiptHandle失效。加快消费速度或者增加队列的不可见时间。 | ||
| TopicNotExist | The Topic you provided does not exist. | 主题不存在,请先创建主题。 | |
| SubscriptionNotExist | The subscription you provided does not exist. | 订阅不存在,请先创建订阅。 | |
| QueueNotExist | The queue name you provided is not exist. | 队列不存在,请先创建队列。 | |
| 408 | TimeExpired | The http request you sent is expired. | 请求时间与轻量消息队列(原 MNS)服务器时间相差超过15分钟,建议检查本地时间。 | 
| 409 | SubscriptionAlreadyExist | The subscription you want to create already exists. | 同名订阅已经存在,且请求属性与原有订阅属性不同。 | 
| TopicAlreadyExist | The topic you want to create already exists. | 同名主题已存在,并且请求属性与原有主题属性不同。 | |
| QueueAlreadyExist | The queue you want to create is already exist. | 同名队列已存在,且请求属性与原有队列属性不同。 | |
| 429 | TooManyRequests | The request is denied by cluster flow limiter for too many requests. | 请求量超过设定的限流阈值,触发限流策略。更多信息,请参见限流策略。 | 
| 500 | InternalError | Interal error. | 系统错误,请联系轻量消息队列(原 MNS)技术支持。 | 
| InternalServerError | Interal error. | 系统错误,请联系轻量消息队列(原 MNS)技术支持。 | 
- ①②:在请求内容的XML元素名称。 
- ③:在轻量消息队列(原 MNS)中某个参数的下限值。 
- ④:在轻量消息队列(原 MNS)中某个参数的上限值。 
- ⑤:在URL请求中QueryString的元素。