Amazon ECS stopped tasks error codes for the Fargate launch type - Amazon Elastic Container Service

Amazon ECS stopped tasks error codes for the Fargate launch type

The following are the possible error messages you may receive when your Fargate task is stopped unexpectedly. The error messages are returned by the container agent and the prefix is dependent on the platform version the task is using.

To check your stopped tasks for an error message using the AWS Management Console, see View Amazon ECS stopped task errors.

TaskFailed to start errors

The following are some TaskFailedToStart error messages and actions that you can take to fix the errors.

Unexpected EC2 error while attempting to Create Network Interface with public IP assignment enabled in subnet 'subnet-id': InsufficientFreeAddressesInSubnet

This happens when a Fargate task that uses the aswsvpc network mode and runs in a subnet with a public IP address, and the subnet does not have enough IP addresses.

The number of available IP addresses is available on the subnet details page in the Amazon EC2 console, or by using describe-subnets. For more information, see View your subnet in the Amazon VPC User Guide.

To fix this issue, you can create a new subnet to run your task in.

InternalError: <reason>

This error occurs when an ENI attachment is requested. Amazon EC2 asynchronously handles the provisioning of the ENI. The provisioning process takes time. Amazon ECS has a timeout in case there are long wait times or unreported failures. There are times when the ENI is provisioned, but the report comes to Amazon ECS after the failure timeout. In this case, Amazon ECS sees the reported task failure with an in-use ENI.

The selected task definition is not compatible with the selected compute strategy

This error occurs when you chose a task definition with a launch type that does not match the cluster capacity type. For more information, see Amazon ECS launch types. You need to select a task definition that matches the capacity probider assigned to your cluster.

ResourceInitializationError errors

The following are some ResourceInitialization error messages and actions that you can take to fix the errors.

failed to initialize logging driver: <reason>

This error occurs when your Fargate task fails to find the CloudWatch log group you defined in the task definition. For information about how to debug and fix this issue, see How do I resolve the "ResourceInitializationError: failed to validate logger args" error in Amazon ECS on AWS re:Post.

unable to pull secrets or registry auth: execution resource retrieval failed: unable to get registry auth from asm

Fargate platform version 1.4.0 does not have a network path from the VPC where your task runs to the Amazon ECR repository, or Secrets Manager.

You can use any of the following solutions:

  • Launch your tasks into a public subnet with a public IP address and that uses an internet gateway. This internet gateway allows your tasks to communicate with the Amazon ECR repository, or Secrets Manager. For more information, see Public subnet and internet gateway.

  • Launch tasks in a private subnet that has a VPC routing table configured to route outbound traffic via a NAT gateway in a public subnet. For more information, see Private subnet and NAT gateway.

  • Launch tasks in a private subnet and make sure you have AWS PrivateLink endpoints configured in your VPC, for the services you need (for example, Amazon ECR). For more information, see Amazon ECS interface VPC endpoints (AWS PrivateLink).

failed to invoke EFS utils commands to set up EFS volumes: stderr

The following issues might prevent you from mounting your Amazon EFS volumes on your Fargate tasks:

  • The Amazon EFS file system isn't configured correctly.

  • The task doesn't have the required permissions.

  • There are issues related to network and VPC configurations.

For information about how to debug and fix this issue, see Why can't I mount my Amazon EFS volumes on my AWS Fargate tasks on AWS re:Post.

ecr:GetAuthorizationToken

The task must have the task execution role. For information about the role see Amazon ECS task execution IAM role.

SpotInterruption errors

The following are some SpotInterruptions error messages and actions that you can take to fix the errors.

SpotInterruption

This error occurs when there is no Fargate Spot capacity or when Fargate takes back Spot capacity.

You can have your tasks run in multiple Availability Zones to allow for more capacity.

InternalError errors

The following are some InternalError error messages and actions that you can take to fix the errors.

InternalError

This error occurs when the agent encounters an unexpected, non-runtime related internal error.

This error only occurs if using platform version 1.4 or later.

For information about how to debug and fix this issue, see How do I troubleshoot an Amazon ECS task that failed to start in an ECS cluster on AWS re:Post.

ContainerRuntimeTimeoutError errors

The following are some ContainerRuntimeTimeoutError error messages and actions that you can take to fix the errors.

Could not transition to running; timed out after waiting 1m: <reason>
DockerTimeoutError (Linux platform version 1.3.0 or earlier)

This error occurs when a container can't transition to either a RUNNING or STOPPED state within the timeout period. The reason and timeout value is provided in the error message.

CannotStartContainerError errors

The following are some CannotStartContainerError error messages and actions that you can take to fix the errors.

failed to get container status: <reason>

This error occurs when a container can't be started.

CannotStopContainerError errors

The following are some CannotStopContainerError error messages and actions that you can take to fix the errors.

CannotStopContainerError

This error occurs when a container can’t be stopped.

For information about how to debug and fix this issue, see Why is my Amazon ECS task Stopped on AWS re:Post.

CannotInspectContainerError errors

The following are some CannotInspectContainerError error messages and actions that you can take to fix the errors.

CannotInspectContainerError

This error occurs when the container agent can't describe the container through the container runtime.

When using platform version 1.3 or earlier, the Amazon ECS agent returns the reason from Docker.

When using platform version 1.4.0 or later (Linux) or 1.0.0 or later (Windows), the Fargate agent returns the reason from containerd.

For information about how to debug and fix this issue, see Why is my Amazon ECS task Stopped on AWS re:Post.

CannotCreateVolumeError errors

The following are some CannotCreateVolumeError error messages and actions that you can take to fix the errors.

CannotCreateVolumeError

This error occurs when the agent can't create the volume mount specified in the task definition.

This error only occurs if you use platform version 1.4.0 or later (Linux) or 1.0.0 or later (Windows).

For information about how to debug and fix this issue, see Why is my Amazon ECS task Stopped on AWS re:Post.

ContainerRuntimeError errors

The following are some ContainerRuntimeError error messages and actions that you can take to fix the errors.

ContainerRuntimeError

This error occurs when the agent receives an unexpected error from containerd for a runtime-specific operation. This error is usually caused by an internal failure in the agent or the containerd runtime.

This error only occurs if you use platform version 1.4.0 or later (Linux) or 1.0.0 or later (Windows).

For information about how to debug and fix this issue, see Why is my Amazon ECS task Stopped on AWS re:Post.

OutOfMemoryError errors

The following are some OutOfMemoryError error messages and actions that you can take to fix the errors.

container killed due to memory usage

This error occurs when a container exits due to processes in the container consuming more memory than was allocated in the task definition.