Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
aa125ecf
Unverified
Commit
aa125ecf
authored
Jan 09, 2026
by
Cyrus Leung
Committed by
GitHub
Jan 08, 2026
Browse files
[Frontend] Improve error message (#31987)
Signed-off-by:
DarkLight1337
<
tlleungac@connect.ust.hk
>
parent
f16bfbe5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
+20
-4
tests/entrypoints/test_utils.py
tests/entrypoints/test_utils.py
+10
-0
vllm/entrypoints/openai/api_server.py
vllm/entrypoints/openai/api_server.py
+4
-4
vllm/entrypoints/utils.py
vllm/entrypoints/utils.py
+6
-0
No files found.
tests/entrypoints/test_utils.py
0 → 100644
View file @
aa125ecf
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from
vllm.entrypoints.utils
import
sanitize_message
def
test_sanitize_message
():
assert
(
sanitize_message
(
"<_io.BytesIO object at 0x7a95e299e750>"
)
==
"<_io.BytesIO object>"
)
vllm/entrypoints/openai/api_server.py
View file @
aa125ecf
...
@@ -88,8 +88,10 @@ from vllm.entrypoints.utils import (
...
@@ -88,8 +88,10 @@ from vllm.entrypoints.utils import (
log_non_default_args
,
log_non_default_args
,
process_chat_template
,
process_chat_template
,
process_lora_modules
,
process_lora_modules
,
sanitize_message
,
with_cancellation
,
with_cancellation
,
)
)
from
vllm.exceptions
import
VLLMValidationError
from
vllm.logger
import
init_logger
from
vllm.logger
import
init_logger
from
vllm.reasoning
import
ReasoningParserManager
from
vllm.reasoning
import
ReasoningParserManager
from
vllm.tasks
import
POOLING_TASKS
from
vllm.tasks
import
POOLING_TASKS
...
@@ -902,7 +904,7 @@ def build_app(args: Namespace) -> FastAPI:
...
@@ -902,7 +904,7 @@ def build_app(args: Namespace) -> FastAPI:
async
def
http_exception_handler
(
_
:
Request
,
exc
:
HTTPException
):
async
def
http_exception_handler
(
_
:
Request
,
exc
:
HTTPException
):
err
=
ErrorResponse
(
err
=
ErrorResponse
(
error
=
ErrorInfo
(
error
=
ErrorInfo
(
message
=
exc
.
detail
,
message
=
sanitize_message
(
exc
.
detail
)
,
type
=
HTTPStatus
(
exc
.
status_code
).
phrase
,
type
=
HTTPStatus
(
exc
.
status_code
).
phrase
,
code
=
exc
.
status_code
,
code
=
exc
.
status_code
,
)
)
...
@@ -911,8 +913,6 @@ def build_app(args: Namespace) -> FastAPI:
...
@@ -911,8 +913,6 @@ def build_app(args: Namespace) -> FastAPI:
@
app
.
exception_handler
(
RequestValidationError
)
@
app
.
exception_handler
(
RequestValidationError
)
async
def
validation_exception_handler
(
_
:
Request
,
exc
:
RequestValidationError
):
async
def
validation_exception_handler
(
_
:
Request
,
exc
:
RequestValidationError
):
from
vllm.exceptions
import
VLLMValidationError
param
=
None
param
=
None
for
error
in
exc
.
errors
():
for
error
in
exc
.
errors
():
if
"ctx"
in
error
and
"error"
in
error
[
"ctx"
]:
if
"ctx"
in
error
and
"error"
in
error
[
"ctx"
]:
...
@@ -931,7 +931,7 @@ def build_app(args: Namespace) -> FastAPI:
...
@@ -931,7 +931,7 @@ def build_app(args: Namespace) -> FastAPI:
err
=
ErrorResponse
(
err
=
ErrorResponse
(
error
=
ErrorInfo
(
error
=
ErrorInfo
(
message
=
message
,
message
=
sanitize_message
(
message
)
,
type
=
HTTPStatus
.
BAD_REQUEST
.
phrase
,
type
=
HTTPStatus
.
BAD_REQUEST
.
phrase
,
code
=
HTTPStatus
.
BAD_REQUEST
,
code
=
HTTPStatus
.
BAD_REQUEST
,
param
=
param
,
param
=
param
,
...
...
vllm/entrypoints/utils.py
View file @
aa125ecf
...
@@ -9,6 +9,7 @@ from argparse import Namespace
...
@@ -9,6 +9,7 @@ from argparse import Namespace
from
pathlib
import
Path
from
pathlib
import
Path
from
typing
import
Any
from
typing
import
Any
import
regex
as
re
from
fastapi
import
Request
from
fastapi
import
Request
from
fastapi.responses
import
JSONResponse
,
StreamingResponse
from
fastapi.responses
import
JSONResponse
,
StreamingResponse
from
starlette.background
import
BackgroundTask
,
BackgroundTasks
from
starlette.background
import
BackgroundTask
,
BackgroundTasks
...
@@ -317,3 +318,8 @@ async def process_chat_template(
...
@@ -317,3 +318,8 @@ async def process_chat_template(
model_config
.
model
,
model_config
.
model
,
)
)
return
resolved_chat_template
return
resolved_chat_template
def
sanitize_message
(
message
:
str
)
->
str
:
# Avoid leaking memory address from object reprs
return
re
.
sub
(
r
" at 0x[0-9a-f]+>"
,
">"
,
message
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment