Skip to content

Fix ImageDeleted/ImageVersionDeleted waiters matching wrong error shape (fixes #3782) - #3787

Open
agu2347 wants to merge 1 commit into
boto:developfrom
agu2347:fix-sagemaker-image-deleted-waiter-issue-3782
Open

Fix ImageDeleted/ImageVersionDeleted waiters matching wrong error shape (fixes #3782)#3787
agu2347 wants to merge 1 commit into
boto:developfrom
agu2347:fix-sagemaker-image-deleted-waiter-issue-3782

Conversation

@agu2347

@agu2347 agu2347 commented Aug 24, 2026

Copy link
Copy Markdown

Fixes #3782.

The sagemaker DescribeImage and DescribeImageVersion operations declare ResourceNotFound as their error shape (see each operation's errors list in botocore/data/sagemaker/2017-07-24/service-2.json). There is no ResourceNotFoundException shape anywhere in this service's model. The ImageDeleted and ImageVersionDeleted waiters, however, matched their success acceptor against ResourceNotFoundException -- a name that never appears in any real response from these operations.

As a result, once an image (or image version) was actually deleted and DescribeImage/DescribeImageVersion started returning the real ResourceNotFound error, none of the acceptors matched, so the waiter incorrectly raised a WaiterError instead of treating the deletion as complete -- exactly the symptom reported in #3782 against the real API.

This fixes both waiters to match on the shape name the operations actually declare and return: ResourceNotFound.

Testing

  • Added TestSagemakerWaiters in tests/functional/test_sagemaker.py, using Stubber to confirm both image_deleted and image_version_deleted waiters treat a ResourceNotFound error as the success condition.
  • Reproduced the bug against develop with a small script using Stubber to inject a ResourceNotFound error: the image_deleted waiter raised WaiterError (matching the reporter's #3782 traceback), then confirmed it passes with this fix, and that reverting the fix while keeping the new test reproduces the failure again.
  • Verified ResourceNotFoundException does not exist anywhere in sagemaker's service-2.json shapes, while ResourceNotFound is the exact shape declared for DescribeImage, DescribeImageVersion, and several other Describe* operations in this service (e.g. DescribeTrainingJob, DescribeProcessingJob, DescribeTransformJob), confirming ResourceNotFound is the correct, consistent shape name to match on.

…pe (boto#3782)

The sagemaker DescribeImage and DescribeImageVersion operations declare
ResourceNotFound as their error shape (per service-2.json's 'errors'
list for each operation) -- there is no ResourceNotFoundException shape
anywhere in this service's model. The ImageDeleted and
ImageVersionDeleted waiters, however, matched their success acceptor
against 'ResourceNotFoundException', a name that never appears in any
real response from these operations.

As a result, once an image (or image version) was actually deleted and
DescribeImage/DescribeImageVersion started returning the real
ResourceNotFound error, none of the acceptors matched, so the waiter
fell through to raising a WaiterError instead of recognizing the
deletion as successful.

Fix both waiters to match on the shape name the operations actually
declare and return: ResourceNotFound.

Added regression tests using Stubber to confirm both waiters treat a
ResourceNotFound error as success.
@agu2347
agu2347 requested a review from a team as a code owner August 24, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

image_deleted waiter fails with WaiterError

1 participant