Skip to content
Latchkey

AWS CDK CREATE_FAILED "Resource handler returned message" in CI

CloudFormation tried to create a resource in your stack and the service handler rejected it. CDK surfaces the per-resource CREATE_FAILED reason, which is the real error - a name clash, a quota, an invalid property, or a missing dependency.

What this error means

cdk deploy reports one or more resources as CREATE_FAILED with "Resource handler returned message: ..." and the stack rolls back to ROLLBACK_COMPLETE or UPDATE_ROLLBACK_COMPLETE.

cdk
MyAppStack | 3/12 | CREATE_FAILED | AWS::S3::Bucket | Bucket (Bucket83908E77)
Resource handler returned message: "my-bucket already exists" (RequestToken: ...,
HandlerErrorCode: AlreadyExists)

Common causes

A resource property or name is invalid or taken

The handler reports the specifics: a globally unique name already exists, a property is out of range, or a referenced resource is missing.

A service quota or limit was hit

The account hit a limit (for example number of buckets, ENIs, or policy size) and the resource cannot be created until raised.

How to fix it

Read the per-resource CREATE_FAILED reason

  1. Find the first CREATE_FAILED line; later failures are usually cascades.
  2. Fix the named property: pick a unique name, correct the value, add the dependency.
  3. Re-deploy after the stack finishes rolling back.

Inspect events when the message is terse

List the stack events to see the full handler message for the failing logical id.

Terminal
aws cloudformation describe-stack-events --stack-name MyAppStack \
  --query "StackEvents[?ResourceStatus=='CREATE_FAILED']"

How to prevent it

  • Run cdk diff to catch obviously invalid changes before deploy.
  • Avoid hardcoded globally unique names that can collide.
  • Watch service quotas for the resources you create.

Related guides

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