Anthropic Python SDK v2.12.0: New Error Code and Behavior Change for Bedrock User Profiles
The latest Anthropic Python SDK adds a new error code and changes the handling of user profile IDs for Amazon Bedrock models, impacting API request outcomes and error handling.
What changed?
The Anthropic Python SDK (v2.12.0) introduces a new API error code, image_dimensions_too_large, to provide clearer error reporting for image input size violations. Additionally, requests using AnthropicBedrock or AsyncAnthropicBedrock clients now include the user_profile_id in the request body, complying with Amazon Bedrock's expected usage. A breaking change is that if a user profile ID is sent to Bedrock models that do not support user profiles, the request now fails with a 400 error instead of silently ignoring the ID.
Why does it matter to an everyday developer?
Developers relying on user profiles in Amazon Bedrock integrations must adjust to the stricter enforcement. Previously, including a user_profile_id header with models that did not support it had no effect. With this update, including a user profile ID with unsupported models results in request failure, which may disrupt automated workflows if not accounted for. The new error code for images allows more specific error handling in pipelines accepting image input, aiding debugging and UX.
What can the developer do now?
- Check model compatibility with user profiles before including user_profile_id in Bedrock messages.
- Handle the image_dimensions_too_large error explicitly in code working with image input.
- Update error handling and tests to expect a 400 error for unsupported user profile ID requests on Bedrock.
- Audit any automated scripts or API integrations for assumptions about silent failures regarding user profiles.

