Skip to content
Latchkey

SAM "sam deploy" change set failed / waiter error in CI

sam deploy creates a CloudFormation change set, then executes it. A failure at create time (an invalid template or no changes) or at execute time (a resource failure) stops the deploy with a change set or waiter error.

What this error means

sam deploy fails with "Failed to create the changeset" plus a reason, or "Waiter ChangeSetCreateComplete failed" / "Waiter StackUpdateComplete failed: terminal failure" during execution.

sam
Error: Failed to create changeset for the stack: myapp,
Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state:
Status: FAILED. Reason: Template error: resource Function does not have a Handler

Common causes

An invalid template rejected at change set creation

A template error (a missing required property, a bad reference) makes CloudFormation refuse to create the change set, surfaced through the waiter.

A resource failure while executing the change set

The change set was created but a resource failed during execution, so the stack rolls back and the execute waiter reports a terminal failure.

How to fix it

Read the change set FAILED reason

  1. Use the waiter reason text to identify the template or resource error.
  2. Validate the template to catch structural errors early.
  3. Fix the template/resource and redeploy.
Terminal
sam validate --lint
sam deploy --no-confirm-changeset

Distinguish create vs execute failures

A ChangeSetCreateComplete failure is a template problem; a StackUpdateComplete failure is a runtime resource problem you read from the stack events.

How to prevent it

  • Run sam validate --lint in CI before deploy.
  • Review change set diffs for risky resource replacements.
  • Keep templates and the SAM CLI version aligned.

Frequently asked questions

What causes ""Failed to create the changeset""?
A template error (a missing required property, a bad reference) makes CloudFormation refuse to create the change set, surfaced through the waiter.
How do I fix "Failed to create the changeset"?
Read the change set FAILED reason

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card