
# APIG的API错误码说明
当调用API时，可能遇到下表中的错误码。如果遇到"APIGW"开头的错误码，请参见[API网关错误码](https://support.huaweicloud.com/devg-apisign/api-sign-errorcode.html)进行处理。
![](https://support.huaweicloud.com/usermanual-apig/public_sys-resources/note_3.0-zh-cn.png)
- 通过APIG接口管理API，发生错误时，产生的错误码请参考[错误码](https://support.huaweicloud.com/api-apig/ErrorCode.html)章节处理。
- 使用APIG错误码时，请以错误码（如APIG.0101）为准，错误信息并非固定不变，有时会对错误信息进行优化修改。
 
表1错误码 
| 错误码       | 错误信息                                                                 | HTTP状态码 | 语义                                                                                           | 解决方案                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|:---|:---|:---|:---|:---|
| APIG.0101 | The API does not exist or has not been published in the environment. | 404     | API不存在或未发布到环境                                                                                | 1. 检查调用API所使用的域名、请求方法、路径是否正确。  2. 检查API是否发布。  3. 检查域名解析是否正确。  4. 检查API是否使用OPTIONS跨域请求，如果使用OPTIONS跨域请求，请在API中开启CORS。   具体操作请参见[常见问题](https://support.huaweicloud.com/apig_faq/apig-faq-19123002.html)。 |
| APIG.0101 | The API does not exist.                                              | 404     | API请求方法不存在                                                                                   | 检查API请求方法是否与API定义的方法相同。                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| APIG.0103 | The backend does not exist.                                          | 500     | 无法找到后端                                                                                       | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0104 | The plug-ins do not exist.                                           | 500     | 无法找到插件配置                                                                                     | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0105 | The backend configurations do not exist.                             | 500     | 无法找到后端配置                                                                                     | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0106 | Orchestration error.                                                 | 400     | 编排错误                                                                                         | 检查API配置的前后端参数是否合理。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| APIG.0107 | The custom lua script encountered an unexpected error.               | 500     | Lua脚本发生未知错误                                                                                  | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0108 | The server group ID does not exist.                                  | 404     | 服务器分组ID不存在                                                                                   | 请检查服务器分组配置信息。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| APIG.0201 | API request error.                                                   | 400     | 请求格式不合法                                                                                      | 检查请求格式是否合法。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| APIG.0201 | Request entity too large.                                            | 413     | 请求body过大（大于12M）                                                                              | 减小请求body大小。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| APIG.0201 | Request URI too large.                                               | 414     | 请求URI过大（大于32K）                                                                               | 减小请求URI大小。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0201 | Request headers too large.                                           | 494     | 请求头过大（单个请求头大于32K或所有请求头总长度大于128K）                                                             | 减小请求头大小。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| APIG.0201 | Backend unavailable.                                                 | 502     | 后端不可用                                                                                        | - 检查API配置的后端地址是否可用。  - 如果后端服务为ECS，ECS配置的安全组规则是否拦截了API请求。  - 请求协议是否正确。  - 后端服务链接链路是否可通。   具体操作请参见[常见问题](https://support.huaweicloud.com/apig_faq/apig_0087908599.html)。                                              |
| APIG.0201 | Backend timeout.                                                     | 504     | 后端超时                                                                                         | 编辑API增大超时时间，或缩小后端的处理时间。                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| APIG.0201 | An unexpected error occurred.                                        | 500     | 内部错误                                                                                         | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0202 | Backend unavailable.                                                 | 502     | 后端不可用                                                                                        | 检查API配置的后端请求协议与后端服务请求协议是否一致。                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| APIG.0203 | Backend timeout.                                                     | 504     | 后端超时                                                                                         | 编辑API增大超时时间，或缩小后端的处理时间。                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| APIG.0204 | SSL protocol is not supported: TLSv1.1.                              | 400     | SSL协议版本不支持                                                                                   | 使用支持的SSL协议版本，当前支持TLS1.1和TLS1.2，推荐使用TLS1.2。                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0205 | Verify client certificate failed.                                    | 400     | 客户端证书校验失败                                                                                    | 检查客户端证书是否正确。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| APIG.0301 | Incorrect IAM authentication information.                            | 401     | IAM认证信息错误                                                                                    | 检查请求的方法、路径、查询参数、请求体和签名使用的方法、路径、查询参数、请求体是否一致；检查客户端机器时间是否正确。请参见[常见问题](https://support.huaweicloud.com/apig_faq/apig-faq-0003.html)。                                                                                                                                                                                                                                                                                                                                                                    |
| APIG.0302 | The IAM user is not authorized to access the API.                    | 403     | IAM用户不允许访问API                                                                                | 检查用户是否被黑白名单限制。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| APIG.0303 | Incorrect app authentication information.                            | 401     | APP认证信息错误                                                                                    | 检查请求的方法、路径、查询参数、请求体和签名使用的方法、路径、查询参数、请求体是否一致；检查客户端机器时间是否正确。请参见[常见问题](https://support.huaweicloud.com/apig_faq/apig-faq-0009.html)。                                                                                                                                                                                                                                                                                                                                                                    |
| APIG.0304 | The app is not authorized to access the API.                         | 403     | APP不允许访问API                                                                                  | 检查凭据是否绑定API，或API是否授权给凭据。                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| APIG.0305 | Incorrect authentication information.                                | 401     | 认证信息错误                                                                                       | 检查认证信息是否正确。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| APIG.0306 | API access denied.                                                   | 403     | 不允许访问API                                                                                     | 检查是否授权访问API。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| APIG.0307 | The token must be updated.                                           | 401     | token需要更新                                                                                    | 重新从IAM获取token。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| APIG.0308 | The throttling threshold has been reached.                           | 429     | 超出流控值限制                                                                                      | 等待流控刷新后访问。如果触发调试域名的单日请求数上限，请绑定独立域名。                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| APIG.0310 | The project is unavailable.                                          | 403     | project不可使用                                                                                  | 使用其他project访问。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| APIG.0311 | Incorrect debugging authentication information.                      | 401     | 调试认证信息错误                                                                                     | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0312 | Incorrect third-party authentication information,auth fail.          | 401     | 第三方认证信息错误，认证失败                                                                               | 检查身份信息是否正确。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| APIG.0313 | Incorrect third-party authentication information,identities error.   | 401     | 第三方认证信息错误，身份错误                                                                               | 检查请求中身份信息与第三方认证插件中身份来源设置是否一致。                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| APIG.0314 | Incorrect third-party authentication information,access deny.        | 403     | 第三方认证信息错误，访问拒绝                                                                               | 联系技术支持工程师确认请求来源是否为业务请求，如果是，则提高第三方认证插件的防暴力拦截阈值。                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| APIG.0316 | Verify token failed during oidc_auth.                                | 401     | OIDC认证Token校验失败                                                                              | 检查access token是否正确。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| APIG.0317 | Get discovery info from discovery_url failed during oidc_auth.       | 400     | OIDC认证获取discovery信息失败                                                                        | 检查discovery是否填写正确，IDP服务是否运行正常。                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| APIG.0318 | Code flow failed during oidc_auth.                                   | 401     | OIDC认证授权码流程失败                                                                                | 检查discovery、scope等配置项是否填写正确，IDP服务中是否设置了插件中的重定向API。                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| APIG.0319 | The JWT authentication plug-in fails to verify the token.            | 401     | JWT认证插件校验token失败                                                                             | 请检查token和公钥信息是否正确，若设置了JWKS_URI服务请检查服务是否正常。                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0401 | Unknown client IP address.                                           | 403     | 无法识别客户端IP地址                                                                                  | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0402 | The IP address is not authorized to access the API.                  | 403     | IP地址不允许访问                                                                                    | 检查IP地址是否被API的访问控制限制。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| APIG.0403 | The IP address cannot be accessed.                                   | 403     | IP地址不允许访问                                                                                    | 检查IP地址是否被实例级访问控制限制。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| APIG.0404 | Access to the backend IP address has been denied.                    | 403     | 后端IP不允许访问                                                                                    | 后端IP地址或后端域名对应的IP地址不允许访问。                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| APIG.0405 | The app is not accessed from a trusted IP address.                   | 403     | 未从受信任的IP地址访问应用程序                                                                             | 检查源IP是否在访问控制策略中配置了允许或者拒绝。                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| APIG.0406 | AI API key authentication failed.                                    | 403     | AI API Key认证失败                                                                               | 请检查API调用的AIAPIKey信息是否正确。                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| APIG.0501 | The app quota has been used up.                                      | 405     | APP已经超出配额 或云商店调用次数用完                 | 购买APP配额。 或重新购买云商店调用次数。                                                                                                                                                                                                                                                                                                                                                                                                                         |
| APIG.0502 | The app has been frozen.                                             | 405     | APP被冻结                                                                                       | 余额不足。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| APIG.0601 | Internal server error.                                               | 500     | 内部错误                                                                                         | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0602 | Bad request.                                                         | 400     | 非法请求                                                                                         | 检查请求是否合法。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| APIG.0605 | Domain name resolution failed.                                       | 500     | 域名解析失败                                                                                       | 检查域名拼写，以及域名是否绑定了正确的后端地址。                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| APIG.0606 | Failed to load the API configurations.                               | 500     | 未加载API配置                                                                                     | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0607 | The following protocol is supported: {xxx}.                          | 400     | 协议不被允许，允许的协议是*xxx。* 注意：xxx以实际响应中的内容为准。 | 改用支持的协议（HTTP/HTTPS）访问。                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| APIG.0608 | Failed to obtain the admin token.                                    | 500     | 无法获取管理账户                                                                                     | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0609 | The VPC backend does not exist.                                      | 500     | 找不到负载后端                                                                                      | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0610 | No backend available.                                                | 502     | 没有可连接的后端                                                                                     | 检查所有后端是否可用，如调用信息与实际配置是否一致。                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0611 | The backend port does not exist.                                     | 500     | 后端端口未找到                                                                                      | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0612 | An API cannot call itself.                                           | 500     | API调用自身                                                                                      | 修改API后端配置，递归调用层数不能超过10层。                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| APIG.0613 | The IAM service is currently unavailable.                            | 503     | IAM服务暂时不可用                                                                                   | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0615 | Incorrect third-party authentication VPC information.                | 500     | 获取第三方鉴权负载通道节点失败                                                                              | 检查第三方认证的负载通道配置是否正确。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| APIG.0616 | Incorrect third-party authentication request information.            | 500     | 连接第三方鉴权服务失败                                                                                  | 检查第三方认证服务是否正常。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| APIG.0617 | Incorrect third-party authentication response information.           | 500     | 获取第三方鉴权服务响应失败                                                                                | 检查第三方认证服务是否正常。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| APIG.0624 | Unsupported signature algorithm: {x}                                 | 400     | 不支持的签名算法：{x}                                                                                 | 使用支持的算法，签名后重试请求。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| APIG.0705 | Backend signature calculation failed.                                | 500     | 计算后端签名失败                                                                                     | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.0802 | The IAM user is forbidden in the currently selected region.          | 403     | 该IAM用户在当前region中被禁用                                                                          | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.2102 | PublicKey is null.                                                   | 400     | 签名密钥未找到                                                                                      | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.2201 | Appkey or SecretKey is invalid.                                      | 400     | Appkey或SecretKey不合法                                                                          | 检查请求的Appkey或SecretKey是否正确。                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.2202 | Refresh token is invalid.                                            | 400     | Refresh token不合法                                                                             | 检查Refresh token是否正确。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| APIG.2203 | Access token is invalid.                                             | 400     | Access token不合法                                                                              | 检查Access token是否正确。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| APIG.2204 | ContentType invalid.                                                 | 400     | ContentType不合法                                                                               | 检查ContentType是否正确                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| APIG.2205 | Auth parameter invalid.                                              | 400     | 认证参数不合法                                                                                      | 检查认证参数是否正确。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| APIG.2206 | Auth method invalid.                                                 | 400     | 认证方法不合法                                                                                      | 检查认证方法是否正确。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| APIG.2208 | The length of through_data is out of range.                          | 400     | through_data超长                                                                               | through_data长度上限为300，根据实际情况调整through_data内容。                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| APIG.2209 | The value of grant_type is not in enum List.                         | 400     | grant_type的值不合法                                                                              | grant_type只支持client_credentials、refresh_token，根据实际情况修改。                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| APIG.2210 | Lack of grant_type.                                                  | 400     | 缺少授权类型                                                                                       | 添加grant_type。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| APIG.2211 | Lack of client_id.                                                   | 400     | 缺少客户端ID                                                                                      | 添加客户端ID。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| APIG.2212 | Lack of client_secret.                                               | 400     | 缺少客户端密钥                                                                                      | 添加客户端密钥。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| APIG.2213 | Lack of refresh_token.                                               | 400     | 缺少refresh token                                                                              | 联系技术支持工程师。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.2218 | Invalid AI API key length.                                           | 400     | AI API Key长度非法                                                                               | 请检查API调用的API Key长度是否正确，API Key的有效长度范围是8\~128。                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| APIG.1001 | Refresh token is expired.                                            | 401     | Refresh token过期                                                                              | 重新获取refresh token。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| APIG.1002 | Access token is expired.                                             | 401     | Access token过期                                                                               | 重新获取access token。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| APIG.1003 | App not match refresh token.                                         | 401     | App与refresh token不匹配                                                                         | 检查client_id是否正确。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| APIG.1004 | App not exist.                                                       | 401     | App不存在                                                                                       | 检查access token是否正确。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| APIG.1009 | AppKey or AppSecret is invalid.                                      | 400     | AppKey或AppSecret不合法                                                                          | 检查请求的AppKey或AppSecret是否与凭据的Key或Secret相同。                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| APIG.3075 | The AI API key does not exist.                                       | 404     | AI API Key不存在                                                                                | 检查AI API Key是否存在。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| APIG.3155 | The AI API key exceeds the upper limit.                              | 403     | AI API Key超过配置限制                                                                             | 请联系技术支持工程师扩大AI API Key的配额。                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| APIG.3333 | The AI API key already exists.                                       | 400     | AI API Key已存在                                                                                | 请修改AI API Key，使其与现有的AI API Key不重复。                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
   
