Skip to content

fix(vertex): raise clear error when using structured outputs on Vertex AI#1199

Open
bledden wants to merge 1 commit intoanthropics:mainfrom
bledden:bledden/fix-vertex-structured-outputs
Open

fix(vertex): raise clear error when using structured outputs on Vertex AI#1199
bledden wants to merge 1 commit intoanthropics:mainfrom
bledden:bledden/fix-vertex-structured-outputs

Conversation

@bledden
Copy link

@bledden bledden commented Feb 24, 2026

Summary

Calling messages.parse() with an AnthropicVertex client sends output_config in the request body, but Vertex AI's Claude proxy doesn't support this parameter. The result is a confusing 400 error from Google:

BadRequestError: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error',
'message': 'output_config.format: Extra inputs are not permitted'}}

This adds a check in the Vertex client's _prepare_options to detect output_config and raise an AnthropicError with a clear message before the request goes out. Follows the same pattern as the existing batch API check on line 410 of the same file.

The error message suggests using the standard Anthropic client or manually parsing JSON responses as a workaround until Google adds output_config support to their proxy.

Added a test that verifies parse() raises AnthropicError on the Vertex client. All 19 vertex tests pass.

Fixes #1188

…x AI

Vertex AI's Claude proxy does not support the output_config parameter,
so calling messages.parse() with an AnthropicVertex client results in a
confusing 400 error from Google: "output_config.format: Extra inputs are
not permitted".

This adds a check in _prepare_options to detect output_config and raise
an AnthropicError with a clear message before the request is sent.
Follows the same pattern as the existing batch API check.

Fixes anthropics#1188
@bledden bledden requested a review from a team as a code owner February 24, 2026 06:04
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.

Structured outputs with Claude 4.6 on Vertex AI results in error

1 participant