aws container_error ai_generated true

STOPPED (Essential container in task exited) - CannotPullContainerError or ResourceInitializationError

ID: aws/aws-fargate-task-failed

Also available as: JSON · Markdown
82%Fix Rate
85%Confidence
100Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
2 active

Root Cause

Fargate task stopped due to image pull failure, resource initialization error, or container crash.

generic

Workarounds

  1. 88% success Check stopped task reason and container exit code in ECS console or CLI
    aws ecs describe-tasks --cluster CLUSTER --tasks TASK_ARN --query 'tasks[].stoppedReason'

    Sources: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/stopped-task-errors.html

  2. 85% success For CannotPullContainerError: ensure task execution role has ECR access and VPC has NAT gateway or VPC endpoints
    Attach AmazonECSTaskExecutionRolePolicy to execution role; verify subnet has internet access for ECR pulls

    Sources: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_execution_IAM_role.html

Dead Ends

Common approaches that don't work:

  1. Increase task CPU/memory to fix CannotPullContainerError 90% fail

    Image pull errors are network or permission issues, not resource limits

  2. Restart the ECS service to fix persistent task failures 80% fail

    Service restart re-launches the same task definition; configuration errors persist

Error Chain

Frequently confused with: