Skip to content

(cli): changeset fails to delete when pre-deployment validation fails #1767

Description

@juweeks

Describe the bug

  1. cdk diff a new stack with a bucket, but the bucket already exists
  2. changeset created, fails with Resource name conflict (expected)
  3. no cli output at all - have to go to the console to view or go into verbose mode
  4. changeset doesn't get deleted, stack stays in "REVIEW IN PROGRESS" state
  5. cdk diff again, doesn't delete the existing changeset and can't do a proper diff (has to use template)
  6. the only way to delete the changeset is to go into the console and delete

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

cdk diff deletes the changeset and stack doesn't permanently stay in REVIEW sgtate

Current Behavior

first diff runs with:

[20:50:47] DeploymentError: Early validation failed for change set cdk-diff-change-set:
mystack/bucket/Resource  (AWS::S3::Bucket mybucket)
  Resource of type 'AWS::S3::Bucket' with identifier 'mybucket' already exists. (at
  /Resources/mybucket)
Source Location: ...aws-cdk-lib, jsii runtime, node internals...
                 (no user code in 10 frames, use --stack-trace-limit to capture more)
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)```

second diff:

[20:55:12] Attempting to create ChangeSet with name cdk-diff-change-set for stack mystack
[20:55:12] AlreadyExistsException: ChangeSet cdk-diff-change-set cannot be created due to a mismatch with existing attribute ClientToken
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)



### Reproduction Steps

1. `cdk diff mystack` with a bucket in the construct with the name that already exists on a bucket somewhere 
2. cfn validation fails and stays in review state
3. `cdk diff mystack` again

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.1133.0

### Framework Version

_No response_

### Node.js Version

26.5.0

### OS

macos tahoe 26.5.2

### Language

Python

### Language Version

_No response_

### Other information

would also like to add that i don't see any flag that disables this pre-deployment check

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions