Error handling

Updated at:

When PDS cannot process an API request, it returns an error response that identifies the failure. This topic describes the formats that PDS uses for error responses and lists the common error codes that the PDS service returns.

To troubleshoot a failed request, first determine which layer reported the error, and then look up the error code:

  • A JSON response body that contains Code and Message indicates that the PDS service reported the error. Look up the value of Code in Common error codes.

  • A response that has no JSON error body but carries the x-ca-error-code and x-ca-error-message headers indicates that the gateway layer reported the error. For the meaning of each header, see Gateway error response. The x-ca-request-id header is returned for both kinds of error response, so you cannot use it to tell the two apart.

Error response format

Service error response

If an error occurs while PDS processes a request, PDS returns an error response in the following format:

{
  "Message": "The input parameter file_id is not valid.",
  "RequestId": "772328B2-E5F4-453C-9C23-CCCCCCCC",
  "Code": "InvalidParameter"
}

The HTTP status code of the response varies with the error. The response body contains the following fields:

  • Code — The error code, which indicates the type of the error.

  • Message — The error message, which indicates the cause of the error and how to resolve it.

  • RequestId — The unique ID of the request. When you call an API operation, this value is returned in the x-ca-request-id response header.

Gateway error response

In a small number of scenarios, the gateway layer reports the error. In this case, the error code and the error message are returned in response headers instead of a JSON response body:

x-ca-error-code: D504TO
x-ca-error-message: timeout
x-ca-request-id: 772328B1-E5F4-453C-9C23-CCCCCCCC

The response contains the following headers:

  • x-ca-error-code — The error code, which indicates the type of the error.

  • x-ca-error-message — The error message, which indicates the cause of the error and how to resolve it.

  • x-ca-request-id — The unique ID of the request.

Common error codes

The following tables list the common error codes that the PDS service returns in the Code field of an error response body, grouped by the kind of problem that they report. These error codes cover most of the errors that may occur. Error codes that the gateway layer returns in the x-ca-error-code header are not listed in this topic. When you read the tables, note the following points:

  • In an actual response, PDS replaces each placeholder in braces with a specific value. {parameter_name} corresponds to the field name, and {resource_name} corresponds to the resource type.

  • The HTTP status code column shows the HTTP status code of the response.

  • The information in the Message column may differ slightly from the actual response, usually to indicate more specific error information.

Parameter and request errors

The following table lists the PDS error codes that indicate a problem with the parameters, headers, body, or HTTP method of the request.

HTTP status code

Code

Message

400

InvalidParameter

The input parameter {parameter_name} is not valid.

400

InvalidParameterEmpty

The input parameter {parameter_name} is empty.

400

InvalidParameterWrongFormat

The input parameter {parameter_name} has an invalid format.

400

InvalidRequestJSONFormat

The input parameter {parameter_name} is not in a valid JSON format.

400

InvalidParameterNotSupported

The input parameter {parameter_name} is not supported.

400

InvalidParameterMissing

The input parameter {parameter_name} is missing.

400

InvalidParameterNotMatch

The input parameter {parameter_name} does not match.

400

InvalidParameterOutOfRange

The input parameter {parameter_name} does not match the limitation.

400

InvalidParameterExpired

The input parameter {parameter_name} is expired.

400

InvalidHeader

The header {header_name} is not valid.

400

DriveRelativePathNested

The input parameter relative_path is nested inside another relative_path: {path}.

400

ReadBodyError

Failed to read the request body.

405

HTTPMethodNotAllowed

The HTTP method of the request is not supported for this resource. See the API documentation for the supported methods.

Resource and state errors

The following table lists the PDS error codes that indicate a problem with the target resource or with the current state of the resource.

HTTP status code

Code

Message

400

QuotaExhausted

The resource {resource_name} has exceeded the limit.

400

InvalidResource

The resource {resource_name} is not valid.

400

InvalidResourceUnsupported

The resource {resource_name} is not supported.

400

NotEmpty

The resource {resource_name} is not empty.

400

AlreadyExist

The resource {resource_name} already exists.

400

Sha1Conflict

Multiple objects with the same sha1 value were found.

400

IncorrectStatus

The current status does not support this operation.

400

StateConflict

The user operation is not valid. Try again later.

404

InvalidResourceIsEmpty

The resource {resource_name} is empty.

404

NotFound

The resource {resource_name} cannot be found.

Authentication, permission, and account errors

The following table lists the PDS error codes that indicate that the request was rejected because of a credential, permission, or account problem.

HTTP status code

Code

Message

400

SignatureDoesNotMatch

SignatureDoesNotMatch.

403

Forbidden

The user is not authorized to operate on the specified API operations.

403

ForbiddenNoPermission

No permission to access the resource {resource_name}.

403

ForbiddenAccountNotFound

The specified account does not exist.

403

ForbiddenAccountInDebt

The specified account is in debt.

403

ForbiddenServiceRole

Cannot access the specified service role.

403

ForbiddenRiskControl

This operation is forbidden by the Alibaba Cloud RiskControl system.

403

ForbiddenFileInTheRecycleBin

This operation is forbidden for a file in the recycle bin.

Throttling and server errors

The following table lists the PDS error codes that indicate that PDS throttled the request or could not complete it.

HTTP status code

Code

Message

400

Throttling

The operation is blocked due to throttling control.

500

InternalError

The request failed due to an unknown error. Try again later.

503

ServiceUnavailable

The request failed due to a temporary failure of the server. Try again later.

Contact us

Every PDS error response identifies the request that failed: both kinds of error response return the ID in the x-ca-request-id header, and a service error response also exposes the ID in the RequestId field of the response body. Record this ID before you report an error that you cannot resolve.

If you have any questions, feel free to contact us.