
# 错误码
调用接口出错后，将不会返回结果数据。调用方可根据每个接口对应的错误码来定位错误原因。 当调用出错时，HTTP 请求返回一个 4xx 或 5xx 的 HTTP 状态码。返回的消息体中是具体的错误代码及错误信息。在调用方找不到错误原因时，可以联系华为云客服，并提供错误码，以便我们尽快帮您解决问题。
#### 错误响应Body体格式说明
当接口调用出错时，会返回错误码及错误信息说明，错误响应的Body体格式如下所示。
```
{
    "error_msg": "attached policies per agency limit exceeded",
    "error_code": "PAP5.0003",
    "request_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
```
其中，error_code表示错误码，error_msg表示错误描述信息，request_id表示本次请求的ID。
特别地，如果是因为缺少权限而出错时，错误相应的Body体格式如下所示。
```
{
    "error_msg": "access denied: xxx...xxx",
    "error_code": "PAP5.0001",
    "request_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "encoded_authorization_message": "xxx...xxx"
}
```
其中，encoded_authorization_message为该场景下额外提供的字段，表示加密后的认证失败信息，可以通过STS5解密接口进行解密。
#### 错误码说明
当您调用API时，如果遇到"APIGW"开头的错误码，请参见[API网关错误码](https://support.huaweicloud.com/devg-apisign/api-sign-errorcode.html)进行处理；如果遇到"IAM"开头的错误码，请参见[经典IAM错误码](https://support.huaweicloud.com/api-iam/iam_02_0006.html)进行处理。
表1错误码 
| 状态码 | 错误码                 | 错误信息                                                                                             | 描述                                               | 处理措施                                                     |
|:---|:---|:---|:---|:---|
| 400 | PAP5.0010           | invalid marker                                                                                   | 无效的marker。                                       | 请检查marker字段的值是否正确。                                       |
| 400 | PAP5.0011           | malformed policy document                                                                        | 身份策略或信任策略内容错误。                                   | 请检查policy document字段的值是否正确。                              |
| 400 | PAP5.0029           | invalid agency name                                                                              | 无效的信任委托名。                                        | 请检查agency name字段的值是否正确。                                  |
| 400 | PAP5.0030           | invalid path                                                                                     | 无效的path。                                         | 请检查path字段的值是否正确。                                         |
| 400 | PAP5.0033           | duplicate key                                                                                    | 重复的键值。                                           | 请确认请求或联系技术支持。                                            |
| 400 | PAP5.0036           | tag non-compliant                                                                                | 标签值不匹配预设规则。                                      | 请确认请求或联系技术支持。                                            |
| 400 | PAP5.0038           | This operation is only supported by v5 agencies                                                  | 仅信任委托支持此类操作。                                     | 请确认请求或联系技术支持。                                            |
| 400 | PAP5.0040           | invalid caller                                                                                   | 无效的调用方。                                          | 请确认调用方是否为IAM用户。                                          |
| 400 | PAP5.0041           | invalid serial number                                                                            | 无效的序列号。                                          | 请检查serial number字段的值是否正确。                                |
| 400 | PAP5.0060           | ip address not in ip range                                                                       | IP地址不在IP段中。                                      | 请检查客户端IP地址是否在请求体IP段中。                                    |
| 400 | PAP5.0070           | invalid content type                                                                             | 无效的内容类型。                                         | 请检查X-Content-Type请求头的值是否正确。                              |
| 400 | PAP5.0257           | the input is invalid                                                                             | 无效的请求体。                                          | 请确认请求或联系技术支持。                                            |
| 400 | PAP5.0046           | missing header \`x-user-profile\`                                                                | 请求头中缺少x-user-profile。                            | 请确认请求或联系技术支持。                                            |
| 400 | PAP5.0102           | OpenID Well-Known URL is empty                                                                   | OpenID Well-Known URL为空。                         | 请提供有效的OpenID Well-Known URL。                             |
| 400 | PAP5.0103           | invalid URL and must end with '/.well-known/openid-configuration'                                | 无效的URL，必须以'/.well-known/openid-configuration'结尾。 | 请确保URL以'/.well-known/openid-configuration'结尾。            |
| 400 | PAP5.0104           | HTTPS protocol required                                                                          | HTTPS协议是必需的。                                     | 请使用HTTPS协议。                                              |
| 400 | PAP5.0105           | invalid OIDC metadata                                                                            | 无效的OIDC元数据。                                      | 请提供有效的OIDC元数据。                                           |
| 400 | PAP5.0106           | issuer host does not match Well-Known URL host                                                   | issuer主机与Well-Known URL主机不匹配。                    | 请确保issuer主机与Well-Known URL主机一致。                          |
| 400 | PAP5.0107           | invalid issuer or Well-Known URL format                                                          | 无效的issuer或Well-Known URL格式。                      | 请提供有效的issuer和Well-Known URL格式。                           |
| 400 | PAP5.0108           | JWKS URI must use HTTPS                                                                          | JWKS URI必须使用HTTPS。                               | 请使用HTTPS协议的JWKS URI。                                     |
| 400 | PAP5.0109           | Well-Known endpoint unreachable                                                                  | Well-Known端点不可达。                                 | 请确保Well-Known端点可访问。                                      |
| 400 | PAP5.0110           | JWKS endpoint unreachable                                                                        | JWKS端点不可达。                                       | 请确保JWKS端点可访问。                                            |
| 400 | PAP5.0111           | JWKS keys array is empty                                                                         | JWKS密钥数组为空。                                      | 请提供有效的JWKS密钥。                                            |
| 400 | PAP5.0112           | invalid jwks format                                                                              | 无效的jwks格式。                                       | 请提供有效的jwks格式。                                            |
| 400 | PAP5.0115           | authorization_endpoint is required                                                               | authorization_endpoint是必需的。                      | 请提供authorization_endpoint。                               |
| 400 | PAP5.0116           | authorization_endpoint must use HTTPS                                                            | authorization_endpoint必须使用HTTPS。                 | 请使用HTTPS协议的authorization_endpoint。                       |
| 400 | PAP5.0117           | id_token_signing_alg_values_supported is required                                                | id_token_signing_alg_values_supported是必需的。       | 请提供id_token_signing_alg_values_supported。                |
| 400 | PAP5.0118           | id_token_signing_alg_values_supported must include RS256                                         | id_token_signing_alg_values_supported必须包含RS256。  | 请在id_token_signing_alg_values_supported中包含RS256。         |
| 400 | PAP5.0121           | OIDC provider already exists.                                                                    | OIDC 身份提供商已存在                                    | 请检查现有的 OIDC 提供商列表，确保没有重复的提供商。                            |
| 400 | PAP5.0122           | No such OIDC provider.                                                                           | 未找到 OIDC 身份提供商                                   | 请确认OIDC提供商是否存在。                                          |
| 400 | PAP5.0123           | OIDC providers limit exceeded.                                                                   | OIDC 身份提供商数量超出限制                                 | 请检查已配置的 OIDC 提供商数量。                                      |
| 400 | PAP5.0124           | Thumbprints cannot be empty.                                                                     | 指纹不能为空                                           | 指纹不能为空。                                                  |
| 400 | PAP5.0125           | Client id already exists.                                                                        | 客户端 ID 已存在                                       | 请检查现有的客户端 ID，确保没有重复的提供商。                                 |
| 400 | PAP5.0126           | Client id not found.                                                                             | 未找到客户端 ID                                        | 请检查客户端 ID 是否正确。                                          |
| 400 | PAP5.0127           | Cannot remove the last client id.                                                                | 无法移除最后一个客户端 ID                                   | 请检查确保至少有一个客户端 ID 存在                                      |
| 400 | PAP5.0128           | Invalid OIDC cert chain.                                                                         | 无效的 OIDC 证书链                                     | 请确认OIDC证书链是否正确。                                          |
| 400 | PAP5.0129           | Client ids cannot exceed 100.                                                                    | 客户端 ID 数量不能超过100个                                | 请确认客户端 ID 数量是否正确。                                        |
| 400 | PAP5.0130           | Failed to retrieve or validate OIDC discovery document.                                          | 获取或校验 OIDC discovery文档失败。                        | 请确认OIDC discovery文档是否正确。                                 |
| 400 | PAP5.0131           | Failed to retrieve or validate JWK set.                                                          | 获取或校验 JWKS 失败                                    | 请确认JWKS是否正确。                                             |
| 400 | PAP5.0136           | Saml provider already exists.                                                                    | SAML 身份提供商已存在                                    | 修改SAML名称                                                 |
| 400 | PAP5.0137           | No such saml provider.                                                                           | 未找到 SAML 提供商                                     | 请确认SAML提供商是否存在。                                          |
| 400 | PAP5.0138           | Saml providers limit exceeded.                                                                   | SAML 身份提供商数量超出限制                                 | 请检查已配置的SAML提供商数量。                                        |
| 400 | PAP5.0139           | Private key not found.                                                                           | SAML 解密私钥不存在                                     | 请确认SAML 解密私钥是否存在                                         |
| 400 | PAP5.0140           | Invalid saml metadata.                                                                           | 无效的 SAML 元数据文档                                   | 请检查SAML元数据文档                                             |
| 400 | PAP5.0141           | Invalid saml private key.                                                                        | 无效的 SAML 解密私钥                                    | 请检查SAML 解密私钥                                             |
| 400 | PAP5.0142           | Private key limit exceeded.                                                                      | SAML 解密私钥超出最大限制                                  | 请先删除SAML 解密私钥后再添加                                        |
| 400 | PAP5.0143           | Assertion encryption need private key.                                                           | 断言加密需要添加 SAML 解密私钥                               | 请添加SAML解密私钥                                              |
| 403 | PAP5.0001           | access denied: %s                                                                                | 访问受限。                                            | 请确认是否允许此操作。                                              |
| 404 | PAP5.0012           | no such agency                                                                                   | 未找到此委托或信任委托。                                     | 请确认请求或联系技术支持。                                            |
| 404 | PAP5.0014           | no such authorization schema                                                                     | 未找到此授权概要。                                        | 请确认请求或联系技术支持。                                            |
| 404 | PAP5.0015           | no such deletion task                                                                            | 未找到此删除任务。                                        | 请确认请求或联系技术支持。                                            |
| 404 | PAP5.0016           | no such group                                                                                    | 未找到此用户组。                                         | 请确认请求或联系技术支持。                                            |
| 404 | PAP5.0018           | no such policy                                                                                   | 未找到此身份策略。                                        | 请确认请求或联系技术支持。                                            |
| 404 | PAP5.0019           | no such policy attachment                                                                        | 未找到此身份策略附加记录。                                    | 请确认请求或联系技术支持。                                            |
| 404 | PAP5.0020           | no such policy version                                                                           | 未找到此身份策略版本。                                      | 请确认请求或联系技术支持。                                            |
| 404 | PAP5.0021           | no such user                                                                                     | 未找到此IAM用户。                                       | 请确认请求或联系技术支持。                                            |
| 404 | PAP5.0022           | no such service linked agency                                                                    | 未找到此服务关联委托。                                      | 请确认请求或联系技术支持。                                            |
| 404 | PAP5.0023           | no such service principal                                                                        | 未找到此服务主体。                                        | 请确认请求或联系技术支持。                                            |
| 404 | PAP5.0034           | no such domain                                                                                   | 未找到此租户。                                          | 请确认请求或联系技术支持。                                            |
| 404 | PAP5.0037           | Resource tag not found                                                                           | 未找到此资源标签。                                        | 请确认请求或联系技术支持。                                            |
| 409 | PAP5.0003           | attached policies per agency limit exceeded                                                      | 单个委托或信任委托附加的身份策略数超过限制。                           | 请分离多余的身份策略。                                              |
| 409 | PAP5.0004           | attached policies per group limit exceeded                                                       | 单个用户组附加的身份策略数超过限制。                               | 请分离多余的身份策略。                                              |
| 409 | PAP5.0005           | attached policies per user limit exceeded                                                        | 单个IAM用户附加的身份策略数超过限制。                             | 请分离多余的身份策略。                                              |
| 409 | PAP5.0006           | concurrent modification                                                                          | 并发修改。                                            | 请稍后重试。                                                   |
| 409 | PAP5.0007           | delete conflict: %s                                                                              | 存在冲突，无法删除。                                       | 请解决冲突。                                                   |
| 409 | PAP5.0024           | policies limit exceeded                                                                          | 自定义身份策略数超过限制。                                    | 请删除多余的自定义身份策略。                                           |
| 409 | PAP5.0025           | policy already exists                                                                            | 身份策略已存在。                                         | 请确认请求或联系技术支持。                                            |
| 409 | PAP5.0026           | policy attachment already exists                                                                 | 该身份策略已附加。                                        | 请确认请求或联系技术支持。                                            |
| 409 | PAP5.0027           | policy size limit exceeded                                                                       | 身份策略或信任策略内容的字节数超过最大值%d（不包括空白字符）。                 | 请精简身份策略或信任策略的内容。                                         |
| 409 | PAP5.0028           | versions per policy limit exceeded                                                               | 单个身份策略的版本数超过限制。                                  | 请删除多余的身份策略版本。                                            |
| 409 | PAP5.0031           | agency already exists                                                                            | 该委托或信任委托已存在。                                     | 请确认请求或联系技术支持。                                            |
| 409 | PAP5.0035           | tags limit exceeded                                                                              | 标签数量超过上限。                                        | 请确认请求或联系技术支持。                                            |
| 409 | PAP5.0039           | mfa device already exists                                                                        | 该MFA设备已存在。                                       | 请确认请求或联系技术支持。                                            |
| 409 | PAP5.0042           | user already exists                                                                              | 该IAM用户已存在。                                       | 请确认请求或联系技术支持。                                            |
| 409 | PAP5.0043           | group already exists                                                                             | 该用户组已存在。                                         | 请确认请求或联系技术支持。                                            |
| 409 | PAP5.0044           | user already in group                                                                            | 该IAM用户已在该用户组中。                                   | 请确认请求。                                                   |
| 409 | PAP5.0045           | login profile already exists                                                                     | 登录信息已存在。                                         | 请确认请求或联系技术支持。                                            |
| 403 | STS5.1001           | you are not authorized to perform this operation                                                 | 无权限，拒绝请求。                                        | 检查用户权限。                                                  |
| 400 | STS5.1102           | the duration seconds exceed the max session duration                                             | 请求中的会话时长超过了可配置的最大会话时长。                           | 请将请求会话时长配置在3600秒以内。                                      |
| 400 | STS5.1301           | the encoded message is malformed or invalid                                                      | 编码信息格式错误或无效。                                     | 请传入正确编码的信息。                                              |
| 400 | STS5.1901           | the IDP provider account does not match the agency account                                       | 身份提供商所属账号与信任委托所属账号信息不匹配。                         | 请传入正确的身份提供商和信任委托信息。                                      |
| 404 | STS5.1902           | the SAML provider URN not found                                                                  | 未找到SAML身份提供商URN。                                 | 请传入正确的SAML身份提供商URN。                                      |
| 400 | STS5.1903           | the SAML metadata is invalid                                                                     | 无效的SAML元数据。                                      | 创建SAML身份提供商时，请传入正确的SAML元数据。                              |
| 400 | STS5.1904           | the SAML assertion is invalid                                                                    | 无效的SAML断言。                                       | 请参考返回的err_msg信息检查SAML断言。                                 |
| 400 | STS5.1905           | the number of session managed policy ids exceeds the limit                                       | 会话管理策略ID数量超过限制。                                  | 请检查SAML断言中的SessionPolicyIds数量和请求参数的policy_ids数量之和是否超过20。 |
| 400 | STS5.1906           | the SAML assertion is required encrypted                                                         | SAML断言需要加密。                                      | 请传入加密后的SAML断言。                                           |
| 400 | STS5.1907           | the agency in SAML assertion is invalid                                                          | SAML断言中的信任委托无效。                                  | 请检查SAML断言中的Agency是否与请求匹配。                                |
| 400 | STS5.2001           | invalid oidc id token                                                                            | 无效的OIDC令牌。                                       | 请参考返回的err_msg信息检查OIDC令牌。                                 |
| 404 | STS5.2002           | oidc provider URN not found                                                                      | 未找到OIDC身份提供商URN。                                 | 请传入正确的OIDC身份提供商URN。                                      |
| 500 | STS5.2003           | invalid account id                                                                               | 无效的账号id。                                         | 请确认请求或联系技术支持。                                            |
| 400 | STS5.2004           | the cert chain from jwks_uri is invalid                                                          | jwks_uri中的证书链无效。                                 | 请确保您的jwks_uri正确且可访问。                                     |
| 400 | STS5.2005           | the thumbprint from jwks is inconsistent with the oidc provider's thumbprint                     | jwks_uri的证书指纹与OIDC身份提供商的指纹不一致。                   | 请确保您的jwks_uri证书指纹与身份提供商详情中的指纹匹配。                         |
| 500 | STS5.2006           | supports domestic and international users only                                                   | 不支持的账号类型。                                        | 请检查您的账号信息，目前仅支持华为云国内站和国际站用户。                             |
| 400 | STS5.2007           | the jwk set is invalid                                                                           | jwk set内容无效。                                     | 请参考返回的err_msg信息检查您的jwk set内容。                            |
| 400 | STS5.2008           | connection error                                                                                 | 连接异常。                                            | 请确保您的well-known uri和jwks_uri正确且可访问。                      |
| 404 | AccessAnalyzer.1001 | Analyzer with id %s cannot be found.                                                             | 找不到ID为%s的分析器。                                    | 请确认分析器ID是否正确                                             |
| 400 | AccessAnalyzer.1002 | The marker is invalid.                                                                           | 分页标记无效。                                          | 请确认翻页标记是否正确                                              |
| 400 | AccessAnalyzer.1003 | The number of tags attached to a resource has exceeded the maximum limit.                        | 附加到资源的标签数量已超出最大限制。                               | 请参考返回的error message信息检查标签数量                              |
| 404 | AccessAnalyzer.1004 | Finding with id %s cannot be found.                                                              | 找不到 ID为 %s 的分析结果。                                | 具体原因请联系技术支持                                              |
| 409 | AccessAnalyzer.1005 | The target of the operation is currently being modified by a different request, try again later. | 您操作的目标当前正在被其他请求修改，请稍后重试。                         | 请稍后重试                                                    |
| 404 | AccessAnalyzer.1006 | Archive rule with id %s cannot be found.                                                         | 找不到 ID 为 %s 的存档规则。                               | 具体原因请联系技术支持                                              |
| 400 | AccessAnalyzer.1007 | The finding filter with key %s is invalid.                                                       | 分析结果的筛选条件 %s 无效。                                 | 请输入正确的筛选条件                                               |
| 400 | AccessAnalyzer.1008 | The request of the update findings operation is invalid.                                         | 更新分析结果的请求无效。                                     | 具体原因请联系技术支持                                              |
| 403 | AccessAnalyzer.1009 | The request is forbidden: %s.                                                                    | 访问被拒绝：%s。                                        | 具体原因请联系技术支持                                              |
| 400 | AccessAnalyzer.1010 | The resource urn %s is invalid.                                                                  | 资源URN无效：%s。                                      | 请输入正确的资源URN                                              |
| 400 | AccessAnalyzer.1011 | The resource owner account %s is invalid.                                                        | 资源所有者的账号无效：%s。                                   | 请输入正确的账号                                                 |
| 400 | AccessAnalyzer.1012 | The number of analyzers for account has exceeded the maximum limit.                              | 该账号创建的账号级分析器已达上限。                                | 请参考返回的error message信息检查分析器的数量                            |
| 400 | AccessAnalyzer.1013 | Missing %s parameter in the request.                                                             | 请求中缺少 %s 参数。                                     | 请参考返回的error message信息检查请求参数                              |
| 400 | AccessAnalyzer.1014 | The number of archive rules of an analyzer has exceeded the maximum limit.                       | 分析器的存档规则数量已超出最大限制。                               | 请参考返回的error message信息检查存档规则数量                            |
| 400 | AccessAnalyzer.1015 | Invalid resource type in the request.                                                            | 资源策略类型请求参数无效。                                    | 请输入正确的策略资源类型                                             |
| 400 | AccessAnalyzer.1016 | Existing an archive rule with same name.                                                         | 已存在同名存档规则。                                       | 请参考返回的error message信息检查存档规则                              |
| 400 | AccessAnalyzer.1017 | Existing an analyzer tag with same key.                                                          | 附加到资源的标签的键重复。                                    | 请参考返回的error message信息检查资源的标签键                            |
| 404 | AccessAnalyzer.1018 | Preview with id s% cannot be found.                                                              | 找不到 ID 为 %s 的预览。                                 | 请参考返回的error message信息检查访问预览ID                            |
| 409 | AccessAnalyzer.1019 | Preview with id %s does not have a completed status.                                             | ID 为 %s 的预览状态不是完成。                               | 请参考返回的error message信息检查访问预览ID                            |
| 400 | AccessAnalyzer.1020 | Only support one resource configuration.                                                         | 仅支持有且仅有一种资源配置项。                                  | 请参考返回的error message信息检查资源配置项                             |
| 400 | AccessAnalyzer.1021 | The resource type %s is not supported yet.                                                       | 目前不支持 %s 资源。                                     | 请参考返回的error message信息检查资源                                |
| 400 | AccessAnalyzer.1022 | The number of analyzers for organization has exceeded the maximum limit.                         | 该账号创建的组织级分析器已达上限。                                | 请参考返回的error message信息检查组织分析器个数                           |
| 400 | AccessAnalyzer.1023 | Only management account or delegated administrator can create organization analyzer.             | 只有组织管理员和委托管理员可以创建组织级分析器。                         | 请参考返回的error message信息检查权限                                |
| 409 | AccessAnalyzer.1024 | Analyzer is %s.                                                                                  | 分析器当前状态为 %s。                                     | 请参考返回的error message信息检查分析器状态                             |
| 400 | AccessAnalyzer.1025 | The analyzer type %s is invalid.                                                                 | %s 分析器不支持当前操作。                                   | 请参考返回的error message信息检查访问分析预览功能                          |
| 400 | AccessAnalyzer.1026 | Missing %s parameter in the request.                                                             | 请求中缺少 %s 参数。                                     | 请参考返回的error message信息检查请求参数                              |
| 400 | AccessAnalyzer.1027 | The account has been suspended %s.                                                               | 该账号已被冻结： %s。                                     | 请参考返回的error message信息检查账号状态                              |
| 400 | AccessAnalyzer.1028 | The account has been restricted %s.                                                              | 该账号已受限： %s。                                      | 请参考返回的error message信息检查账号状态                              |
| 400 | AccessAnalyzer.1031 | Please check no new access error: %s.                                                            | 检测是否有新访问权限的 %s 错误。                               | 请参考返回的error message信息检查策略                                |
| 400 | AccessAnalyzer.1032 | Please don't check no new access error on the deny statement.                                    | 不能在只有拒绝语句的策略上检查是否有新访问权限。                         | 请参考返回的error message信息检查策略                                |
   
