Skip to content

fix(bedrock,vertex): add missing 413 and 529 status error handling#1306

Open
4444J99 wants to merge 1 commit intoanthropics:mainfrom
4444J99:fix/bedrock-vertex-status-errors
Open

fix(bedrock,vertex): add missing 413 and 529 status error handling#1306
4444J99 wants to merge 1 commit intoanthropics:mainfrom
4444J99:fix/bedrock-vertex-status-errors

Conversation

@4444J99
Copy link
Copy Markdown

@4444J99 4444J99 commented Mar 27, 2026

The BaseBedrockClient and BaseVertexClient _make_status_error methods are missing handlers for HTTP 413 (RequestTooLargeError) and 529 (OverloadedError). These were added to the main Anthropic/AsyncAnthropic clients in #1244, but the Bedrock and Vertex variants were not updated.

Before this change:

  • AnthropicBedrock receiving a 413 response returns a generic APIStatusError instead of RequestTooLargeError
  • AnthropicBedrock receiving a 529 response returns InternalServerError instead of OverloadedError
  • Same for AnthropicVertex (and their async counterparts)

After this change:
All three client families (Anthropic, AnthropicBedrock, AnthropicVertex) return the same typed exception for every status code.

Changes

  • src/anthropic/lib/bedrock/_client.py — add 413 and 529 handlers to BaseBedrockClient._make_status_error
  • src/anthropic/lib/vertex/_client.py — add 413 and 529 handlers to BaseVertexClient._make_status_error
  • tests/lib/test_bedrock.py — add parametrized test_make_status_error covering all 11 status codes
  • tests/lib/test_vertex.py — add parametrized test_make_status_error covering all 12 status codes (including Vertex-specific 504)

Test plan

  • All 23 new parametrized tests pass
  • Existing test_make_status_error_sync_async_parity in test_client.py continues to pass
  • No changes to generated code — both files are in lib/ (hand-maintained)

The Bedrock and Vertex clients' _make_status_error methods were missing
handlers for HTTP 413 (RequestTooLargeError) and 529 (OverloadedError).
These were already handled in the main Anthropic/AsyncAnthropic clients
(added in anthropics#1244), but the Bedrock and Vertex variants fell through to
the generic InternalServerError (for 529) or APIStatusError (for 413).

This makes error handling consistent across all client variants, so
users can catch specific exception types regardless of which provider
they use.
@4444J99 4444J99 requested a review from a team as a code owner March 27, 2026 18:33
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