ValidationError: Value is not a valid dict in FastAPI response serialization when running train in local
An error occurred when using FastAPI to handle an ASGI application during a training run. The issue seems to arise when serializing the response, where Pydantic raises a ValidationError, indicating that the expected value is not a valid dictionary.
{ "logger": "uvicorn.error", "timestamp": "2024-09-18T18:24:43.910141Z", "exception": "Traceback (most recent call last): File \"/usr/local/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py\", line 401, in run_asgi result = await app( # type: ignore[func-returns-value] File \"/usr/local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py\", line 70, in __call__ return await self.app(scope, receive, send) File \"/usr/local/lib/python3.8/site-packages/fastapi/applications.py\", line 284, in __call__ await super().__call__(scope, receive, send) File \"/usr/local/lib/python3.8/site-packages/starlette/applications.py\", line 122, in __call__ await this.middleware_stack(scope, receive, send) File \"/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 184, in __call__ raise exc File \"/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 162, in __call__ await this.app(scope, receive, _send) File \"/usr/local/lib/python3.8/site-packages/starlette/middleware/exceptions.py\", line 79, in __call__ raise exc File \"/usr/local/lib/python3.8/site-packages/starlette/middleware/exceptions.py\", line 68, in __call__ await this.app(scope, receive, sender) File \"/usr/local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py\", line 20, in __call__ raise e File \"/usr/local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py\", line 17, in __call__ await this.app(scope, receive, send) File \"/usr/local/lib/python3.8/site-packages/starlette/routing.py\", line 718, in __call__ await route.handle(scope, receive, send) File \"/usr/local/lib/python3.8/site-packages/starlette/routing.py\", line 276, in handle await this.app(scope, receive, send) File \"/usr/local/lib/python3.8/site-packages/starlette/routing.py\", line 66, in app response = await func(request) File \"/usr/local/lib/python3.8/site-packages/fastapi/routing.py\", line 259, in app content = await serialize_response( File \"/usr/local/lib/python3.8/site-packages/fastapi/routing.py\", line 145, in serialize_response raise ValidationError(errors, field.type_) pydantic.error_wrappers.ValidationError: 1 validation error for TrainingResponse response value is not a valid dict (type=type_error.dict)" }
Having the same issue. Have you managed to sort this out?