Your current environment
The output of python collect_env.py
Your output of `python collect_env.py` here
🐛 Describe the bug
The following request
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-oss-120b",
"messages": [
{
"role": "user",
"content": "hello"
}
],
"response_format": {
"type": "json_schema",
"schema": {
"type": "object"
}'} }
results in an HTTP 500 response:
{"error":{"message":"","type":"InternalServerError","param":null,"code":500}}
However, it should return HTTP 400 (Bad Request), because when using "type": "json_schema", the schema must be wrapped inside the json_schema field, like this:
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "response",
"schema": {
"type": "object"
}
}
}
In the vLLM logs:
(APIServer pid=1) WARNING 02-26 11:57:44 [protocol.py:53] The following fields were present in the request but ignored: {'schema'}
(APIServer pid=1) Traceback (most recent call last):
(APIServer pid=1) File "/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/openai/chat_completion/api_router.py", line 58, in create_chat_completion
(APIServer pid=1) generator = await handler.create_chat_completion(request, raw_request)
(APIServer pid=1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=1) File "/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/openai/chat_completion/serving.py", line 394, in create_chat_completion
(APIServer pid=1) sampling_params = request.to_sampling_params(
(APIServer pid=1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=1) File "/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/openai/chat_completion/protocol.py", line 428, in to_sampling_params
(APIServer pid=1) assert json_schema is not None
(APIServer pid=1) ^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=1) AssertionError
(APIServer pid=1) INFO: 127.0.0.1:43142 - "POST /v1/chat/completions HTTP/1.1" 500 Internal Server Error
The issue is that an assert is used to validate user input: https://github.com/vllm-project/vllm/blob/main/vllm/entrypoints/openai/chat_completion/protocol.py#L446
Instead of using assert, the code should explicitly validate the input and raise a ValueError, since this is a client-side request validation issue, not a server error.
Before submitting a new issue...
Your current environment
The output of
python collect_env.py🐛 Describe the bug
The following request
results in an HTTP 500 response:
{"error":{"message":"","type":"InternalServerError","param":null,"code":500}}However, it should return HTTP 400 (Bad Request), because when using
"type": "json_schema", the schema must be wrapped inside thejson_schemafield, like this:In the vLLM logs:
The issue is that an assert is used to validate user input: https://github.com/vllm-project/vllm/blob/main/vllm/entrypoints/openai/chat_completion/protocol.py#L446
Instead of using assert, the code should explicitly validate the input and raise a ValueError, since this is a client-side request validation issue, not a server error.
Before submitting a new issue...