You can run a Cloud Assistant command as expected only when all requirements are met, regardless of whether you use the Elastic Compute Service (ECS) console or log on to an instance to run the command. To ensure that your intended operations are complete, we recommend that you check the command execution results and states. If executions fail, you can troubleshoot the issues based on common error messages.
When exceptions occur, different execution results and states are displayed for the command. These exceptions include a lack of dependencies, network exceptions, command semantic errors, command debugging errors, and abnormal instance status. You can use the ECS console or call an API operation to view the error messages in the execution results and troubleshoot the issues.
View execution results
View execution results in the ECS console
Log on to the ECS console.
In the left-side navigation pane, choose .
In the upper-left corner of the top navigation bar, select a region.
Click the Command Execution Result tab to view execution results.
If a command execution succeeds, you can view the command output in the execution results.
Find a command task for which Successful is displayed in the Status column.
In the Actions column, click View.
In the Execution Details panel, view the execution results on the Task Completed tab of the Instances tab.
If a command execution fails, find the error message in the execution results and troubleshoot the issue based on the error message.
Find a command task for which Task Failed is displayed in the Status column.
In the Actions column, click View.
In the Execution Details panel, view the execution results on the Task Failed tab of the Instances tab.
For information about command errors and solutions, see the Command errors and solutions section of this topic.
View the execution results of a scheduled task.
Find a command task for which Waiting for execution is displayed in the Status column.
In the Actions column, click View.
In the Execution Details panel, view execution results on the Instances tab.
The following figure shows the execution results of a scheduled command task that is executed every 15 minutes.
View execution results by using Alibaba Cloud CLI
If you use Cloud Assistant by means of Alibaba Cloud CLI or OpenAPI Explorer, you can call the DescribeInvocations or DescribeInvocationResults operation to query the execution results of Cloud Assistant commands. If an execution fails, you can check the ErrorCode and ErrorInfo values in the API responses for error details.
In the following examples, the DescribeInvocations and DescribeInvocationResults operations are used to describe how to use Alibaba Cloud CLI to query execution results.
Call the DescribeInvocations operation to query the execution state of a command.
aliyun ecs DescribeInvocations --RegionId TheRegionId --InvokeId your-invoke-id
Call the DescribeInvocationResults operation to query the execution results of a command on a specific instance.
aliyun ecs DescribeInvocationResults --RegionId TheRegionId --InstanceId i-bp1g6zv0ce8og******p --InvokeId your-invoke-id
Command errors and solutions
The instance was not in the Running state while the task was being created.
Check whether the instance is running as expected.
The instance was restarted while the task was being executed.
Do not restart the instance while the task is being executed.
Cloud Assistant Agent was not running.
Cloud Assistant Agent is stopped or not installed. Perform the following operations to start or install Cloud Assistant Agent:
If Cloud Assistant Agent still cannot be started after the preceding operations are performed, re-install Cloud Assistant Agent. For more information, see Install Cloud Assistant Agent.
The instance network environment is abnormal.
Cloud Assistant Agent does not respond.
Troubleshoot the issue based on logs of Cloud Assistant Agent.
Cloud Assistant Agent is not upgraded.
Enable auto-upgrade for Cloud Assistant Agent or manually upgrade Cloud Assistant Agent. For more information, see Upgrade or disable upgrades for Cloud Assistant Agent.
Cloud Assistant Agent is not connected to the server.
Restart Cloud Assistant Agent. For more information, see Start, stop, or uninstall the Cloud Assistant Agent. If Cloud Assistant Agent still cannot connect to the server after the agent is restarted, submit a ticket.
The Cloud Assistant server failed to send the command to Cloud Assistant Agent.
The Cloud Assistant command is not sent to the instance. We recommend that you run the command again. If the issue persists, submit a ticket.
The command execution has timed out.
Extend the command execution timeout period.
An exception occurred while the command was running.
Check the error message in the ErrorInfo field. If you cannot identify the issue based on the error message, submit a ticket.
The command execution is complete but the exit code is not 0.
Check the command script and the command output.
The task was interrupted due to the restart of Cloud Assistant Agent.
Re-execute the task after Cloud Assistant Agent is restarted. You can view the running status of Cloud Assistant Agent on the Cloud Assistant page in the ECS console or by calling the DescribeCloudAssistantStatus operation.
The instance was released while the command was being executed.
The task cannot be executed because the instance has been released.
The specified working directory does not exist on the instance.
Create the working directory on the instance and then re-run the command.
Errors that occur when running a command
Cloud Assistant Agent was being upgraded.
Re-run the command after Cloud Assistant Agent is upgraded. You can view the running status of Cloud Assistant Agent on the Cloud Assistant page in the ECS console or by calling the DescribeCloudAssistantStatus operation.
The selected managed instance was deregistered.
The command cannot be run because the managed instance has been deregistered.
Built-in environment parameters are invalid.
The built-in environment parameters are not supported. For information about built-in environment parameters, see the
The default working directory on the instance is unavailable.
Check the default working directory on the instance:
You can specify a working directory before you run a command, which can be specified by using the Cloud Assistant page or the RunCommand operation with the
The command type is not applicable to the specified instances.
Different instance operating systems support different command types:
The command content is invalid.
Check the command content. The command content can be plaintext or Base64-encoded.
The command content failed to be decoded.
If the command content is Base64-encoded, check whether the Base64 encoding is correct.
The specified user does not exist in the instance.
Create the user and then re-run the command.
You can specify a user before you run a command, which can be specified by using the Cloud Assistant page or the RunCommand operation with the
Errors that occur when running a command on a schedule
The specified cron expression is invalid.
Modify the cron expression. For more information, see the "Run a command on a clock-based schedule" section in Run a command on a schedule.
The cron expression expired so that the scheduled task failed to be executed.
Specify a valid cron expression.
The format of the GMT offset time zone that is specified in the cron expression is invalid.
Check the format of the GMT offset time zone.
Supported GMT range: GMT-12:59 to GMT+14:59. The minute field can be any value from 0 to 59. The hour field does not support leading zeros.
The GMT offset hour value specified in the cron expression is invalid.
Check the GMT offset hour value.
Support GMT range: GMT-12:59 to GMT+14:59. The hour field does not support leading zeros.
The GMT offset minute value specified in the cron expression is invalid.
Check the GMT offset minute value.
The minute field can be any value from 0 to 59.
The timezone files were damaged so that Cloud Assistant Agent failed to process timezone information.
If the required timezone file does not exist, create the timezone file and then re-run the command.
The rate expression is invalid.
Modify the rate expression. For more information, see the "Run a command at a regular interval" section in Run a command on a schedule.
The scheduled execution frequency specified in the rate expression is low.
Set the scheduled execution frequency to be no more than 7 days. The scheduled execution frequency cannot be greater than 7 days.
The at expression is invalid.
Modify the at expression. For more information, see the "Run a command only once at a specific time" section in Run a command on a schedule.
The at expression expired so that the scheduled task failed to be executed.
Specify a valid at expression.
Errors that occur when running a command in a container
The container name is invalid.
The container name can be up to 255 characters in length. It can contain only letters, digits, commas (,), underscores (_), and hyphens (-). It must start with a letter or digit.
The container runtime contained in the container ID is not supported.
Cloud Assistant can be used to run commands only in containers that are managed by Kubernetes based on the Container Runtime Interface (CRI) and run within the Docker, containerd, or CRI-O container runtime.
The container ID is invalid.
Only 64-bit hexadecimal strings are supported. Container IDs that are prefixed with
The container cannot be connected.
Check whether the container is running. You can use
The container does not work as expected.
Check the status of the container and make sure that the container is running. You can use
The container does not exist.
Check whether the ID or name of the container is valid by using one of the following methods:
Method 1: Use kubectl
Method 2: Use Cloud Assistant Agent
For more information, see Use Cloud Assistant to run commands in containers.
Multiple containers on the node have the same name, which causes an issue in identifying the correct container to run the command.
The container ID and the container name do not match.
The specified container ID does not correspond to the specified container name. Check whether the container ID and name are correct.
Errors that occur when running a command as a non-default user (not System) on a Windows instance
The following errors may occur when you run a command on a Windows instance as a non-default user (not System user):
The username or password is incorrect.
Parameters cannot be retrieved from Operation Orchestration Service (OOS) Parameter Store.
Check whether the corresponding password information exists in OOS Parameter Store. For more information, see Manage encryption parameters.
The required instance roles are not attached to the instance.
Call the DescribeInstanceRamRole operation to check whether the required Resource Access Management (RAM) roles are attached to the instance.
Errors that occur when sending a file
A file with the same name already exists in the destination path.
To resolve the error, use one of the following solutions:
The file name is invalid.
Modify the file name to comply with the file naming conventions of Windows or Linux operating systems. Perform one of the following operations:
The destination path is invalid.
Modify the destination path to comply with the path conventions of Windows or Linux operating systems. Perform one of the following operations:
The file permissions are invalid.
Modify the file permissions. File permissions take effect only on Linux instances. You can configure the file permissions in the same way as you configure the chmod command.
The specified user group does not exist in the instance.
By default, the user group is root. Create the specified user group in the instance.