SAM Doctor

ERROR REFERENCE

DELETE_FAILED

CloudFormation tried to delete a stack or a resource and something refused to go. The status reason on the failed resource names the blocker — read it before force-deleting anything.

WHAT IT MEANS

What this error means

DELETE_FAILED appears in two places: as a resource status during a stack delete or rollback, and as the final stack status once any resource fails to delete. The stack is now stuck until the blocker is resolved. The usual blockers, in rough order of frequency:

FIX

How to fix it

  1. Get the exact status reason first:
    aws cloudformation describe-stack-events --stack-name YOUR_STACK \
      --query "StackEvents[?ResourceStatus=='DELETE_FAILED'].[LogicalResourceId,ResourceStatusReason]" \
      --output table
    Preserve it before changing anything — retries overwrite the event history's usefulness.
  2. Resolve the named blocker deliberately. Empty the bucket (including versions and delete markers), wait for or detach the network interface, open the nested stack's events and fix that failure, or remove the import in the dependent stack. Do not reach for force-delete as the first move.
  3. Retry the delete. Many ENI-related failures pass on a plain retry ten minutes later.
  4. If a resource should survive the stack, retain it explicitly on the retry — this skips deletion for that resource and lets the rest of the stack go:
    aws cloudformation delete-stack --stack-name YOUR_STACK \
      --retain-resources LOGICAL_ID
    --retain-resources only works on a stack already in DELETE_FAILED, and the retained resource becomes unmanaged — you own its lifecycle afterwards.
  5. If the delete was refused outright with a termination-protection message, that is a deliberate safeguard, not a failure — find out why protection was enabled before disabling it.

AUTOMATE THE TRIAGE

Diagnose this automatically

SAM Doctor recognizes DELETE_FAILED, the IAM-role deletion blocker, and the termination-protection refusal as distinct findings, each with its own next check. Runs locally; no AWS access, no log upload.

python -m pip install sam-doctor
sam-doctor diagnose deployment.log --format markdown

RELATED