Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValidationError: Value is not a valid dict in FastAPI response serialization when running train in local #1958

Open
shabri-arrahim opened this issue Sep 18, 2024 · 1 comment

Comments

@shabri-arrahim
Copy link

shabri-arrahim commented Sep 18, 2024

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)" }

@okapusta
Copy link

Having the same issue. Have you managed to sort this out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants