From 872c4f6512179fcddfc166da2d3afa41433a56de Mon Sep 17 00:00:00 2001 From: cjackal <44624812+cjackal@users.noreply.github.com> Date: Wed, 24 Dec 2025 13:42:57 +0000 Subject: [PATCH] raise 400 Bad Request with detailed error message for `aiohttp.ClientError` Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com> --- vllm/entrypoints/openai/serving_engine.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vllm/entrypoints/openai/serving_engine.py b/vllm/entrypoints/openai/serving_engine.py index 5ea2a7a572650..c41a8d9744dc1 100644 --- a/vllm/entrypoints/openai/serving_engine.py +++ b/vllm/entrypoints/openai/serving_engine.py @@ -11,6 +11,7 @@ from dataclasses import dataclass, field from http import HTTPStatus from typing import Any, ClassVar, Generic, TypeAlias, TypeVar +import aiohttp import numpy as np from fastapi import Request from openai.types.responses import ( @@ -1210,7 +1211,10 @@ class OpenAIServing: **_chat_template_kwargs, ) - mm_data = await mm_data_future + try: + mm_data = await mm_data_future + except aiohttp.ClientError as e: + raise ValueError(f"{e.__class__.__name__} - {e}") from None # tool parsing is done only if a tool_parser has been set and if # tool_choice is not "none" (if tool_choice is "none" but a tool_parser