Skip to content

Filter unmodeled fields from error output#10142

Open
AndrewAsseily wants to merge 5 commits intoaws:v2from
AndrewAsseily:error-field-tagging
Open

Filter unmodeled fields from error output#10142
AndrewAsseily wants to merge 5 commits intoaws:v2from
AndrewAsseily:error-field-tagging

Conversation

@AndrewAsseily
Copy link
Contributor

@AndrewAsseily AndrewAsseily commented Mar 17, 2026

Description of changes: The CLI's "Additional error details" section previously displayed all fields from the error response, including fields not defined in the service model. This change filters the output to only show fields that are explicitly defined in the service's error shape model.

Non-modeled: https://github.com/aws/aws-cli/blob/v2/awscli/botocore/data/s3/2006-03-01/service-2.json#L8516

Before:

(.venv)  aws-cli % aws s3api get-object --bucket not-a-real-bucket-0000 --key file.txt out.txt

aws: [ERROR]: An error occurred (NoSuchBucket) when calling the GetObject operation: The specified bucket does not exist

Additional error details:
BucketName: not-a-real-bucket-0000

After:

(.venv)  aws-cli % aws s3api get-object --bucket not-a-real-bucket-0000 --key file.txt out.txt                          

aws: [ERROR]: An error occurred (NoSuchBucket) when calling the GetObject operation: The specified bucket does not exist

Modeled: https://github.com/aws/aws-cli/blob/v2/awscli/botocore/data/lambda/2015-03-31/service-2.json#L7930

(.venv) aws-cli % aws lambda get-function --function-name nonexistent-function-12345

aws: [ERROR]: An error occurred (ResourceNotFoundException) when calling the GetFunction operation: Function not found: arn:aws:lambda:us-west-2:<redacted-for-this-PR>:function:nonexistent-function-12345

Additional error details:
Type: User

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@AndrewAsseily AndrewAsseily requested a review from ashovlin March 18, 2026 15:00
@AndrewAsseily AndrewAsseily marked this pull request as ready for review March 18, 2026 15:00
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.

1 participant