[CI][Frontend] Return 422 instead of 500 for invalid Anthropic tool_choice#34590
Merged
vllm-bot merged 1 commit intovllm-project:mainfrom Feb 16, 2026
Merged
Conversation
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request correctly addresses a 500 Internal Server Error that occurred with invalid tool_choice parameters in the Anthropic API compatibility layer. The introduction of a model_validator in AnthropicToolChoice is a clean and effective way to enforce the API contract at the request parsing stage, properly returning a 422 validation error instead of crashing. The associated change to extend the timeout for the /v1/messages endpoint in the schema tests is also appropriate, aligning it with other completion endpoints. The changes are well-targeted and improve the robustness of the server. Good work.
DarkLight1337
approved these changes
Feb 16, 2026
stmoonar
pushed a commit
to stmoonar/vllm
that referenced
this pull request
Feb 16, 2026
…hoice (vllm-project#34590) Signed-off-by: Andreas Karatzas <akaratza@amd.com> Signed-off-by: stmoonar <xx0294432@gmail.com>
athrael-soju
pushed a commit
to athrael-soju/vllm
that referenced
this pull request
Feb 16, 2026
…hoice (vllm-project#34590) Signed-off-by: Andreas Karatzas <akaratza@amd.com> Signed-off-by: athrael-soju <athrael-soju@users.noreply.github.com>
wzhao18
pushed a commit
to wzhao18/vllm
that referenced
this pull request
Feb 18, 2026
…hoice (vllm-project#34590) Signed-off-by: Andreas Karatzas <akaratza@amd.com> Signed-off-by: wzhao18 <wzhao18.sz@gmail.com>
eldarkurtic
pushed a commit
to eldarkurtic/vllm
that referenced
this pull request
Feb 19, 2026
…hoice (vllm-project#34590) Signed-off-by: Andreas Karatzas <akaratza@amd.com> Signed-off-by: Eldar Kurtic <research@neuralmagic.com>
ZJY0516
pushed a commit
to ZJY0516/vllm
that referenced
this pull request
Feb 23, 2026
…hoice (vllm-project#34590) Signed-off-by: Andreas Karatzas <akaratza@amd.com> Signed-off-by: zjy0516 <riverclouds.zhu@qq.com>
llsj14
pushed a commit
to llsj14/vllm
that referenced
this pull request
Mar 1, 2026
…hoice (vllm-project#34590) Signed-off-by: Andreas Karatzas <akaratza@amd.com>
tunglinwood
pushed a commit
to tunglinwood/vllm
that referenced
this pull request
Mar 4, 2026
…hoice (vllm-project#34590) Signed-off-by: Andreas Karatzas <akaratza@amd.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
tool_choiceis{"type": "tool"}without aname, the/v1/messagesendpoint crashes with a 500 Internal Server Error. This happens because_convert_anthropic_to_openai_requestpassesname=NonetoChatCompletionNamedToolChoiceParam, which fails Pydantic validation as an unhandled exception.The Anthropic API spec requires
namewhentool_choice.typeis"tool". This PR adds amodel_validatortoAnthropicToolChoiceso the constraint is enforced at request parsing time, producing a proper 422 validation error instead of a 500.Also adds the
/v1/messagesendpoint to the longer timeout map in the schema test, since it is a completion endpoint.Motivation
AMD nightly CI: https://buildkite.com/vllm/amd-ci/builds/4788/steps/canvas?sid=019c6019-8f6f-4b50-a415-c3f443c97c5e&tab=output
schemathesisproperty-based testing intest_openapi_stateless[POST /v1/messages].