All Products
Search
Document Center

Elastic Compute Service:Troubleshoot issues based on API error codes

Last Updated:Feb 05, 2025

When you use the Alibaba Cloud Elastic Compute Service (ECS) API or SDKs or Alibaba Cloud CLI to perform operations on ECS instances, issues may occur and different error codes (ErrorCode) may be returned. In most cases, the issues are caused by incorrect parameters, a lack of required permissions, or incorrect credentials. This topic describes how to identify and troubleshoot issues in a systematic manner.

Incorrect data format

The following sample code provides an example of an incorrect data format when an ECS API operation is called:

{
  "RequestId": "06DD587E-599A-55C6-83BB-EC5******F2",
  "HostId": "ecs.cn-hangzhou.aliyuncs.com",
  "Code": "InvalidP******",
  "Message": "The specified parameter **** is not valid.",
  "Recommend": "https://api.aliyun.com/troubleshoot?q=InvalidP******&product=Ecs&requestId=06DD587E-599A-55C6-83BB-EC5******F2"
}

Parameter description:

  • RequestId: the request ID.

  • HostId: the host ID of the server side.

  • Code: the error code.

  • Message: the error message.

  • Recommend: the URL of the corresponding error diagnostic. You can directly copy the URL to go to the OpenAPI problem diagnosis page to obtain a solution.

The following sample code provides an example of a nonexistent ECS instance:

{
  "RequestId": "81EF1E7D-0D15-5CAF-B602-3487FAFA88D5",
  "HostId": "ecs.cn-hangzhou.aliyuncs.com",
  "Code": "InvalidInstanceId.NotFound",
  "Message": "The specified InstanceId does not exist.",
  "Recommend": "https://api.aliyun.com/troubleshoot?q=InvalidInstanceId.NotFound&product=Ecs&requestId=81EF1E7D-0D15-5CAF-B602-3487FAFA88D5"
}

Common errors

The following section describes specific common errors to help you quickly resolve issues when you call API operations:

  1. Region error: The ID of the region in which the specified resource resides is misspelled or the endpoint of the region is incorrect. You may receive error information similar to InvalidRegionId or NotSupportedEndpoint.

  2. VPC error: Specific resources do not belong to the specified virtual private cloud (VPC). For example, the specified security group ID does not belong to the specified VPC.

  3. Permission issue: Make sure that you have the required permissions to initiate a request. If you do not have the required permissions, you may receive error information similar to Unauthorized or NoPermission.

  4. Incorrect credentials: Make sure that the credentials you enter are correct. If you have multiple accounts, make sure that you use the correct credentials for the account in use. If you provide incorrect credentials, you may receive error information similar to AuthFailure, Invalid, or not belong to you.

  5. API call throttling: To ensure the stability of ECS, ECS throttles API requests. If requests are throttled, you may receive error information similar to request throttling. You can increase the time interval between requests. For more information, see API call throttling.

  6. Quota limit: The quota of a resource is exceeded. You may receive error information similar to QuotaExceed. In this case, check whether the quota of the resource is exceeded. For more information, see Limits.

  7. An ECS instance is locked for security reasons: The ECS instance is locked due to a security violation. You may receive error information similar to InstanceLockedForSecurity. For more information, see API behavior when an instance is locked for security reasons.

  8. Inconsistencies in multiple retries: If a request timeout or an internal server error occurs when you call an API operation, the client may attempt to resend the request. For more information, see How to ensure idempotence.

Troubleshooting procedure

Step 1: Identify the cause based on the error code and error message

In most cases, an error response contains an error code and an error message. You can check the error code and error message to identify the cause of the issue.

  • View the returned error code and error message.

  • Check whether the values of the parameters in the request are correct, including but not limited to the region ID, instance ID, resource type, valid values, and value type.

Identify the issue based on the error code

  • InvalidParameter: indicates an invalid parameter.

  • InvalidHostName.Malformed: indicates an invalid HostName value.

  • InvalidInstanceName.Malformed: indicates an invalid InstanceName value.

Identify the issue based on the error message

  • The specified InstanceId does not exist: indicates that the specified instance ID does not exist.

  • The specified RegionId does not exist: indicates that the specified region ID does not exist.

Step 2: Check the error code guidelines in the API operation documentation

If you cannot identify the cause, you can configure and check the parameters in the request based on the corresponding ECS API operation documentation.

  1. Search for the corresponding error code in the ECS API operation documentation. For information about the common error codes, see Public error codes.

  2. Resolve the issue based on the possible causes and solutions provided in the documentation.

Step 3: Use the OpenAPI problem diagnosis tool to identify the issue

If the issue persists after you perform the preceding steps or the issue is complex, you can use the OpenAPI problem diagnosis tool.image

  • Go to the OpenAPI problem diagnosis page.

  • Enter the error message and use the diagnostic information that the OpenAPI problem diagnosis tool provides to further identify the root cause of the issue.

  • Take measures based on the diagnostic solution and log information.

    image