@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 0f19427db5
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 9, 16:00 UTC

[Perf] Cache exc.errors() result in validation exception handler (#32984)

Signed-off-by: 7. Sun <jhao.sun@gmail.com>

7. Sun committed Jan 24, 2026 at 10:01 UTC 0f19427db587ae425d62a1857ee3339015ee3084
1 file changed +4 -3
vllm/entrypoints/openai/api_server.py
+4 -3
@@ -558,7 +558,8 @@ def build_app(args: Namespace) -> FastAPI:
558 @app.exception_handler(RequestValidationError)
559 async def validation_exception_handler(_: Request, exc: RequestValidationError):
560 param = None
561 - for error in exc.errors():
561 + errors = exc.errors()
562 + for error in errors:
563 if "ctx" in error and "error" in error["ctx"]:
564 ctx_error = error["ctx"]["error"]
565 if isinstance(ctx_error, VLLMValidationError):
@@ -566,9 +567,9 @@ def build_app(args: Namespace) -> FastAPI:
567 break
568
569 exc_str = str(exc)
569 - errors_str = str(exc.errors())
570 + errors_str = str(errors)
571
571 - if exc.errors() and errors_str and errors_str != exc_str:
572 + if errors and errors_str and errors_str != exc_str:
573 message = f"{exc_str} {errors_str}"
574 else:
575 message = exc_str