diff --git a/agents-api/agents_api/web.py b/agents-api/agents_api/web.py index 15554a81..d6d5a210 100644 --- a/agents-api/agents_api/web.py +++ b/agents-api/agents_api/web.py @@ -98,7 +98,10 @@ async def _handler(request: Request, exc: Exception): offending_input = offending_input[loc] # Keep only the message from the error - errors = [error.get("msg", error) for error in errors] + errors = [ + error.get("msg", error) if hasattr(error, "msg") else error + for error in errors + ] else: errors = exc.errors() if hasattr(exc, "errors") else [exc]