Skip to content
Latchkey

SAM "sam deploy" stack in ROLLBACK_COMPLETE cannot update in CI

A CloudFormation stack whose first CREATE failed lands in ROLLBACK_COMPLETE. That state cannot be updated, only deleted, so sam deploy refuses to proceed until the dead stack is removed.

What this error means

sam deploy fails with "Stack <name> is in ROLLBACK_COMPLETE state and can not be updated." The stack exists but only as a failed creation shell.

sam
Error: Failed to create/update the stack: myapp,
Stack myapp is in ROLLBACK_COMPLETE state and can not be updated.

Common causes

The initial stack creation failed and rolled back

The very first deploy of this stack failed a resource, leaving it in ROLLBACK_COMPLETE - a terminal state that only permits deletion.

Re-running deploy on the dead stack

Subsequent deploys target the same name, but CloudFormation cannot update a ROLLBACK_COMPLETE stack, so every retry fails the same way.

How to fix it

Delete the failed stack, then deploy

  1. Delete the ROLLBACK_COMPLETE stack.
  2. Wait for the delete to complete.
  3. Re-run sam deploy to create it cleanly.
Terminal
aws cloudformation delete-stack --stack-name myapp
aws cloudformation wait stack-delete-complete --stack-name myapp
sam deploy

Fix the root cause first

Find the original CREATE_FAILED event that caused the rollback and fix that resource so the fresh create succeeds.

How to prevent it

  • Resolve the first CREATE_FAILED cause before redeploying.
  • Delete dead ROLLBACK_COMPLETE stacks as part of recovery.
  • Validate the template before the initial create.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →