错误返回
更新时间:2026-06-12
接口描述
当用户访问 API 出现错误时,会返回相应的错误码和错误信息,便于定位问题并做出适当处理。请求发生错误时,通过 Response Body 返回详细错误信息,格式如下:
| 参数名 | 类型 | 说明 |
|---|---|---|
code |
String | 表示具体错误类型。 |
message |
String | 有关该错误的详细说明。 |
requestId |
String | 本次请求的 requestId。 |
示例:
JSON
1{
2 "requestId": "728668a7-3785-4f52-ad73-c90c3d312f53",
3 "code": "AccessDenied",
4 "message": "Access denied."
5}
公共错误码
| Code | Message | HTTP Status Code | 说明 |
|---|---|---|---|
AccessDenied |
Access denied. | 403 Forbidden | 无权限访问对应的资源。 |
InappropriateJSON |
The JSON you provided was well-formed and valid, but not appropriate for this operation. | 400 Bad Request | 请求中的 JSON 格式正确,但语义上不符合要求,如缺少某个必需项,或者值类型不匹配等。出于兼容性考虑,对于所有无法识别的项应直接忽略,不应该返回该错误。 |
InternalError |
We encountered an internal error. Please try again. | 500 Internal Server Error | 所有未定义的其他错误。在有明确对应的其他类型错误时,包括通用错误和服务自定义错误,不应该使用该错误。 |
InvalidAccessKeyId |
The Access Key ID you provided does not exist in our records. | 403 Forbidden | Access Key ID 不存在。 |
InvalidHTTPAuthHeader |
The HTTP authorization header is invalid. Consult the service documentation for details. | 400 Bad Request | Authorization 头域格式错误。 |
InvalidHTTPRequest |
There was an error in the body of your HTTP request. | 400 Bad Request | HTTP Body 格式错误,例如不符合指定的 Encoding 等。 |
InvalidURI |
Could not parse the specified URI. | 400 Bad Request | URI 形式不正确,例如一些服务定义的关键词不匹配等。对于 ID 不匹配等问题,应定义更加具体的错误码,例如 NoSuchKey。 |
MalformedJSON |
The JSON you provided was not well-formed. | 400 Bad Request | JSON 格式不合法。 |
InvalidVersion |
The API version specified was invalid. | 404 Not Found | URI 的版本号不合法。 |
OptInRequired |
A subscription for the service is required. | 403 Forbidden | 没有开通对应的服务。 |
PreconditionFailed |
The specified If-Match header doesn't match the ETag header. | 412 Precondition Failed | 详见 ETag的使用。 |
RequestExpired |
Request has expired. Timestamp date is XXX. | 400 Bad Request | 请求超时。XXX 要改成 x-bce-date 的值。如果请求中只有 Date,则需要将 Date 转换为 本规范指定的格式。 |
IdempotentParameterMismatch |
The request uses the same client token as a previous, but non-identical request. | 403 Forbidden | clientToken 对应的 API 参数不一致。 |
SignatureDoesNotMatch |
The request signature we calculated does not match the signature you provided. Check your Secret Access Key and signing method. Consult the service documentation for details. | 400 Bad Request | Authorization 头域中附带的签名和服务端验证不一致。 |
CProm 错误码
| 错误码 | 错误描述 | HTTP 状态码 | 解释 |
|---|---|---|---|
ServiceInternalError |
Internal service occurs error. | 500 | 未定义的服务器内部错误。 |
MalformedJSON |
The JSON you provided was not well-formed. | 400 | JSON 格式不合法。 |
InvalidParam |
Some params are invalid. | 400 | 输入参数不合法。 |
NotFound |
Resource "xxxx" was not found. | 404 | 无法找到该资源。 |
InstanceAlreadyExists |
Instance cprom-xxx already exists. | 409 | 实例已存在。 |
ScrapeJobAlreadyExists |
ScrapeJob was already existed. | 409 | 采集任务已存在。 |
GrafanaAlreadyExists |
Grafana was already existed. | 409 | Grafana 已存在。 |
ServiceUnavailable |
Service is unavailable. | 503 | 服务不可用。 |
BadRequest |
Bad request parameters or illegal request. | 400 | 请求有误。 |
BadRequest |
Cluster cce-xxxxx is not bound to instance cprom-xxxxxx. | 400 | 集群未绑定该 CProm 实例。 |
评价此篇文章
