ERROR REFERENCE
ECS Exec could not start the managed agent
ECS could not start the managed SSM agent required by
execute-command. Check the task's reported state and the
prerequisites before changing permissions blindly.
WHAT IT MEANS
What this error means
CannotStartManagedAgentError: failed to start managed agent inside container
The same condition can surface as an
InvalidParameterException saying that Exec was not enabled
when the task ran or that the execute-command agent is not running.
The wrapper does not identify whether the task flag, task role,
network, agent, or filesystem is the missing prerequisite.
NEXT CHECK
Read the task state, then fix the prerequisite
-
Inspect the task without changing it:
Confirmaws ecs describe-tasks --cluster <cluster> --tasks <task>enableExecuteCommandis true and theExecuteCommandAgentmanaged agent reportslastStatus: RUNNINGwith no failure reason. -
Check launch-time prerequisites. Enable Exec before
launching this task, give its task role the required
ssmmessageschannel actions, and provide network access to the Systems Manager Message Gateway or its VPC endpoint. -
Keep the container filesystem writable. ECS Exec does
not support
readonlyRootFilesystem; a mount that hides the managed-agent paths can produce the same startup failure. Launch a new task after changing the task definition.
AUTOMATE THE TRIAGE
Keep the check in your normal workflow
SAM Doctor recognizes the ECS Exec handoff with medium confidence and points at the task-state, SSM, network, and filesystem checks. Runs locally; no AWS access, no log upload.
python -m pip install sam-doctor
sam-doctor diagnose deployment.log --format markdown
RELATED
Related errors
- Cannot connect to the Docker daemon - a local container-build prerequisite, not an ECS task-agent failure.
- Lambda invoke target not found - a post-deploy check aimed at the wrong function or qualifier.
- Failed to create changeset - a CloudFormation wrapper that needs its complete reason.