Running a Cloud Assistant command from the ECS console is similar to running a command after logging on to an instance. A command runs successfully only if all conditions are met. After you run a command, you should view its execution result and status to ensure that the target operation is complete. If the execution fails, you can use the error messages to identify and fix the problem.
Background information
A command may have different execution statuses and results due to issues such as missing dependencies on an ECS instance, network problems, command semantic errors, script debugging failures, or an abnormal instance status. You can view error messages in the execution results from the console or using an API to diagnose and fix the problem.
View execution results
View results in the console
In the top navigation bar, select the region and resource group of the resource that you want to manage.
On the Command Execution Result tab, you can view the command execution results.
If the command is successful, you can view the output in the execution results.
Find the command execution result where the Execution Status is Successful.
In the Actions column, click View.
On the Instances page, you can view the command execution results on the Task Completed tab.

If the command fails, you can view the error message in the execution results to diagnose and fix the problem.
Find the command execution result where the Execution Status is Execution failed.
In the Actions column, click View.
On the Instances page, you can view the error message on the Execution failed tab.
For information about common error messages and their solutions, see Common execution failure errors and recommended solutions.

View the output of a scheduled task.
Find the command execution result whose Execution Status is Scheduled.
In the Actions column, click View.
On the Instances page, you can view the result of the command.
View results using Alibaba Cloud CLI
For more information about how to use the Cloud Assistant CLI, see Manage Alibaba Cloud resources using Alibaba Cloud CLI.
Obtain the command execution ID (InvokeId) from the response of the RunCommand or InvokeCommand operation.
Enter the InvokeId and the region ID (RegionId) of the ECS instance to query the command execution result. The following example uses the China (Shanghai) region. For the IDs of other regions, see Regions and zones.
Call the
DescribeInvocationsoperation to view the execution status of the command.aliyun ecs DescribeInvocations --RegionId cn-shanghai --InvokeId t-sh054h*****Call the
DescribeInvocationResultsoperation to view the execution result of the command.aliyun ecs DescribeInvocationResults --RegionId cn-shanghai --InvokeId t-sh054h******
View results using an API
Obtain the command execution ID (InvokeId) from the response of the RunCommand or InvokeCommand operation.
In the DescribeInvocations or DescribeInvocationResults operation, enter the InvokeId and the region ID of the ECS instance to query the command execution result.
Common execution failure errors and recommended solutions
Common errors
Error code | Error message | Recommended solution |
InstanceNotRunning | The instance was not in the Running state when the task was created. | Ensure that the instance is in the Running state. |
InstanceRestarted | The instance was restarted during the task execution. | Do not restart the instance during the task execution. |
ClientNotRunning | The Cloud Assistant Agent is not running. | The Cloud Assistant Agent is stopped or not installed. You must start or install the Cloud Assistant Agent.
Note If the Cloud Assistant Agent still fails to start, reinstall it. For more information, see Install the Cloud Assistant Agent. |
ClientNetworkBlocked | The instance has network connectivity issues. |
Note
|
SecurityGroupRuleDenied | A security group rule denies access to the Cloud Assistant service. |
|
ClientNotResponse | The Cloud Assistant Agent is not responding. | Check the Cloud Assistant Agent logs.
|
ClientNeedUpgrade | The Cloud Assistant Agent must be upgraded to support the specified feature. |
|
ClientNotOnline | The Cloud Assistant Agent is not connected to the server. | Restart the Cloud Assistant Agent. For more information, see Stop and uninstall the Cloud Assistant Agent. |
DeliveryTimeout | The Cloud Assistant server failed to send the task to the Cloud Assistant Agent. | The Cloud Assistant command was not sent to the instance. Run the command again. |
ExecutionTimeout | The command execution timed out. | Extend the command execution timeout period as required.
|
ExecutionException | An exception occurred during the command execution. | View the detailed error message in the ErrorInfo field. |
ExitCodeNonzero | The command finished executing, but the exit code of the command process is not 0. | Check the script content and the command output. |
ClientRestarted | The task was interrupted because the Cloud Assistant Agent was restarted. | Run the command again after the restart is complete. You can view the running status of the Cloud Assistant Agent in the Cloud Assistant console or by calling the DescribeCloudAssistantStatus operation. |
InstanceReleased | The instance was released during the command execution. | The command cannot be executed because the instance was released during the execution. |
DirectoryNotExists | The specified working directory does not exist on the instance. | Create the specified working directory on the instance, and then run the command. |
Running commands
Error code | Error message | Recommended solution |
ClientIsUpgrading | The Cloud Assistant Agent is being upgraded. | Run the command again after the upgrade is complete. You can view the running status of the Cloud Assistant Agent in the Cloud Assistant console or by calling the DescribeCloudAssistantStatus operation. |
InstanceDeregistered | The managed instance has been unregistered. | The command cannot be executed because the managed instance was unregistered. |
InvalidSystemBuiltInParameter | The built-in environment parameter is invalid. | The specified built-in environment parameter is not supported. For more information about built-in environment parameters, see the description of the |
DefaultWorkingDirectoryNotAvailable | The default working directory on the instance is not available. | Check the default working directory on the instance:
You can also specify a working directory when you run the command. You can specify the directory in the Cloud Assistant console or using the |
CommandNotApplicable | The command type is not applicable to the specified instance. | The operating systems that are supported by each command type are as follows:
|
InvalidCommandText | The command content is invalid. | Check the command content. The content can be in plaintext or Base64-encoded. |
CommandContentDecodeError | The command content failed to be decoded. | If the command content is Base64-encoded, check whether the encoding is correct. |
AccountNotExists | The specified user does not exist on the instance. | Create the specified user on the instance before you run the command.
You can also specify another existing user to run the command. You can specify the user in the Cloud Assistant console or using the |
Running scheduled commands
Error code | Error message | Recommended solution |
BadCronExpression | The specified cron expression is invalid. | Modify the cron expression. For more information, see Clock-based scheduling. |
CronExpressionExpired | The cron expression has expired. The corresponding scheduled task will not be executed. | Do not specify an expired cron expression when you run the command. |
InvalidGMTOffsetForTimezone | 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. The supported GMT range is GMT-12:59 to GMT+14:59. The minute value can be from 0 to 59. Leading zeros are not supported for the hour. |
InvalidGMTOffsetHourForTimezone | The GMT offset hour value that is specified in the cron expression is invalid. | Check the hour value of the GMT offset time zone. The supported GMT range is GMT-12:59 to GMT+14:59. Leading zeros are not supported for the hour. |
InvalidGMTOffsetMinuteForTimezone | The GMT offset minute value that is specified in the cron expression is invalid. | Check the minute value of the GMT offset time zone. The minute value can be from 0 to 59. |
TimezoneInformationCorrupt | The Cloud Assistant Agent cannot parse the time zone information because the time zone file is corrupted or for other reasons. |
Note If the corresponding time zone file does not exist, create the correct time zone file before you run the command. |
InvalidRateExpression | The Rate expression is invalid. | Modify the Rate expression. For more information, see Fixed-interval execution. |
RateFrequencyTooLarge | The scheduled execution frequency that is specified in the Rate expression is too high. | The scheduled execution frequency cannot exceed 7 days. |
InvalidAtExpression | The UNIX timestamp (At expression) is invalid. | Modify the UNIX timestamp. For more information, see Run a command only once at a specified time. |
AtExpressionExpired | The UNIX timestamp (At expression) has expired. The corresponding scheduled task will not be executed. | Do not specify an expired UNIX timestamp when you run the command. |
Running commands in containers
Error code | Error message | Recommended solution |
InvalidContainerName | The container name is invalid. | The container name must start with a digit or a letter. It can contain only digits, uppercase letters, lowercase letters, periods (.), underscores (_), and hyphens (-). The name cannot exceed 255 characters in length. |
UnsupportedContainerRuntime | The container runtime that is included in the container ID is not supported. | Only containers that are managed by Kubernetes through the Container Runtime Interface (CRI) and run on docker, containerd, or cri-o container runtimes are supported. |
InvalidContainerId | The container ID is invalid. | Only 64-bit hexadecimal strings are supported. You can add the |
ContainerConnectFailed | A connection to the container cannot be established. | Check whether the container is running. You can use
|
ContainerStateAbnormal | The container status is abnormal. | Check the container status. You can run commands using Cloud Assistant only on running containers. You can use |
ContainerNotFound | The container does not exist. | Check whether a container with the specified name or ID exists. Method 1: Use kubectl Method 2: Use the Cloud Assistant Agent For more information, see Use Cloud Assistant to run commands in a container. |
ContainerNameDuplicated | The node has containers with the same name. The container on which to run the command cannot be identified. |
|
ContainerNameAndIdNotMatch | The container ID and container name do not match. | The specified container ID and container name do not correspond to the same container. Check whether the container ID and container name are correct. |
Running commands as a non-default user (System) on a Windows instance
The following issues may occur when you run commands as a non-default user (a user other than System) on a Windows instance.
Error code | Error message | Recommended solution |
UserOrPasswordInvalid | The username or password is incorrect. | The username or the password for the user is incorrect. For more information about usernames and passwords, see Encrypted parameters and Set a regular user to run Cloud Assistant commands. |
QueryParameterStoreFailed | Failed to pull parameters from Parameter Store. | Check whether the corresponding password information exists in the parameter store of CloudOps Orchestration Service. For more information, see Encrypted parameters. |
InstanceRoleInvalid | The instance role is not granted to the instance. | Call the DescribeInstanceRamRole operation to check whether the corresponding RAM role exists on the instance. |
Stopping commands
Error code | Error message | Recommended solution |
TerminationException | Failed to stop the task. | View the detailed error message in the ErrorInfo field, or retry stopping the task. |
Sending files
Error code | Error message | Recommended solution |
FileAlreadyExists | A file with the same name exists in the specified path. | You can resolve this issue in one of the following ways:
Change the destination path or the name of the file on the destination ECS instance. |
FileNameInvalid | The file name is invalid. | Adjust the file name to comply with the file naming conventions of the Windows or Linux operating system.
|
FilePathInvalid | The file path is invalid. | Adjust the file path to comply with the file path conventions of the Windows or Linux operating system.
|
FileAuthorityInvalid | The file permissions are invalid. | Adjust the file permissions. This setting takes effect only on Linux instances and is configured in the same way as the chmod command. |
UserGroupNotExists | The specified user group does not exist on the instance. | The default user group is root. Create the specified user group on the Linux instance. Example command: |
FAQ
Q: When I run a PowerShell script on a Windows server using Cloud Assistant, the Chinese characters in the output are garbled. Why does this happen and how can I fix it?
A: This is because the default environment that Cloud Assistant uses to execute PowerShell does not use UTF-8 encoding to process the output, resulting in an encoding mismatch when the script outputs non-ASCII characters, such as Chinese characters, which causes the control
The content is displayed as garbled characters because the platform cannot parse it correctly.
You can use one of the following solutions:
Modify the script content: Add a line of code at the beginning of the script file to force the output encoding to be UTF-8.
In Windows Server 2022, Cloud Assistant correctly handles Chinese character encoding by default. You do not need to set the encoding to UTF-8.
Add the following code to the beginning of the PowerShell script:
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 Write-Output "Testing Chinese output..."Modify the bootstrap program: In the advanced options of Cloud Assistant, modify the underlying command that runs the script to automatically set the encoding before the script runs.
In the Bootstrap Program field of the Cloud Assistant command, enter the following code:
powershell -command [Console]::OutputEncoding=[System.Text.Encoding]::UTF8;{{ACS::ScriptFileName|Ext(.ps1)}};exit $LastExitCodeAll PowerShell scripts that run in this task will automatically apply UTF-8 encoding. You do not need to modify each script file.