diff --git a/server/main.py b/server/main.py index 40f9ae99..5f3fdd67 100644 --- a/server/main.py +++ b/server/main.py @@ -572,14 +572,13 @@ from fastapi.exceptions import RequestValidationError async def validation_error_handler(request: Request, exc: RequestValidationError): import logging _val_logger = logging.getLogger("nexus.validation") - try: - body = await request.body() - _val_logger.warning( - "422 validation error on %s %s body=%s errors=%s", - request.method, request.url.path, body[:500], exc.errors(), - ) - except Exception: - _val_logger.warning("422 validation error on %s %s errors=%s", request.method, request.url.path, exc.errors()) + client_host = request.client.host if request.client else "unknown" + content_type = request.headers.get("content-type", "") + errors = exc.errors() + _val_logger.warning( + "422 %s %s from %s content_type=%s errors=%s", + request.method, request.url.path, client_host, content_type, errors, + ) from fastapi.responses import JSONResponse return JSONResponse(status_code=422, content={"detail": exc.errors()})