
# 错误码
调用接口出错后，将不会返回结果数据。调用方可根据每个接口对应的错误码来定位错误原因。 当调用出错时，HTTP 请求返回一个 4xx 或 5xx 的 HTTP 状态码。返回的消息体中是具体的错误代码及错误信息。在调用方找不到错误原因时，可以联系华为云客服，并提供错误码，以便我们尽快帮您解决问题。
#### 错误响应Body体格式说明
当接口调用出错时，会返回错误码及错误信息说明，错误响应的Body体格式如下所示。
```
{ 
    "error_msg": "The format of message is error", 
    "error_code": "AS.0001" 
}
```
其中，error_code表示错误码，error_msg表示错误描述信息。
#### 错误码说明
当您调用API时，如果遇到"APIGW"开头的错误码，请参见[API网关错误码](https://support.huaweicloud.com/devg-apisign/api-sign-errorcode.html)进行处理。
表1公共错误码 
| 状态码 | 错误码         | 错误信息                                                          | 描述            | 处理措施           |
|:---|:---|:---|:---|:---|
| 400 | iMetal.0001 | A request parameter contains invalid or unsupported value: %s | 请求包含无效或不支持值参数 | 根据返回的错误信息检查请求体 |
| 400 | iMetal.0002 | Missing required parameters: %s                               | 请求缺少必选参数      | 根据返回的错误信息检查请求体 |
| 401 | iMetal.0003 | Unauthorized                                                  | 请求未鉴权         | 重新鉴权后，再重试      |
| 403 | iMetal.0004 | Insufficient permissions                                      | 权限不足          | 请联系技术支持检查账户权限  |
| 429 | iMetal.0005 | Too many requests                                             | 请求过载          | 稍后重试           |
| 500 | iMetal.0099 | Internal server error                                         | 服务端内部错误       | 指数重试           |
   
表2物理服务器错误码 
| 状态码 | 错误码         | 错误信息                                                           | 描述         | 处理措施                    |
|:---|:---|:---|:---|:---|
| 404 | iMetal.0100 | Physical servers ID not found: \[{id}, ...\]                   | 物理服务器ID不存在 | 检查Physical Server ID有效性 |
| 400 | iMetal.0101 | Physical servers state is not ready: \[{id}, ...\]             | 物理服务器未就绪   | 稍后重试                    |
| 400 | iMetal.0102 | Physical servers ID already exist: \[{id}, ...\]               | 物理服务器已存在   | 检查参数                    |
| 400 | iMetal.0110 | Inspect Physical servers error: \[{id}, ...\], {error details} | 硬件采集失败     | 请参考返回的message，或联系技术支持   |
   
表3裸机实例错误码 
| 状态码 | 错误码         | 错误信息                                           | 描述                         | 处理措施                     |
|:---|:---|:---|:---|:---|
| 404 | iMetal.0200 | Instances not found: \[{id}, ...\]             | 裸机实例不存在                    | 检查Instance ID有效性         |
| 400 | iMetal.0201 | Insufficient server resources                  | 无足够iMetal服务器资源             | 检查Max Count有效性           |
| 400 | iMetal.0202 | Action conflicts with instance's current state | 操作与当前实例状态冲突，比如修改正在删除实例的密码。 | 请参考返回的message，或联系技术支持    |
| 400 | iMetal.0203 | Max Count is less than Min count               | Max count比Min count小       | 检查Max count及Min count有效性 |
| 400 | iMetal.0204 | Image not found                                | 镜像不存在                      | 检查镜像参数有效性                |
| 400 | iMetal.0205 | Invalid password                               | 密码错误                       | 检查密码有效性                  |
| 400 | iMetal.0206 | User data exceeds size limits                  | 用户数据超过32K长度限制              | 缩减自定义脚本长度                |
| 400 | iMetal.0207 | Invalid metadata configuration                 | 元数据配置个数或大小超过限制             | 检查实例元数据个数及长度的有效性         |
| 404 | iMetal.0230 | Subnet not found: \[{id}, ...\]                | 子网不存在                      | 检查子网的有效性                 |
| 400 | iMetal.0231 | Subnet unavailable: \[{id}, ...\]              | 子网不可用                      | 确保子网的状态为ACTIVE           |
| 400 | iMetal.0232 | Insufficient IP addresses in subnet            | 子网IP地址不足                   | 检查子网可用性                  |
| 400 | iMetal.0233 | Specified IP conflict in subnet                | 指定IP地址冲突                   | 检查IP配置有效性                |
| 400 | iMetal.0234 | IP specification prohibited in batch creation  | 批量创建禁止指定IP                 | 移除IP配置参数                 |
| 400 | iMetal.0235 | Create VPC ports overload                      | 批量创建VPC端口过载                | 重试                       |
| 500 | iMetal.0236 | Delete VPC ports failed                        | 删除VPC port失败               | 重试                       |
   
