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

[BUG] pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for <class 'starlette.requests.Request'>. #633

Open
aurotripathy opened this issue Jan 15, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@aurotripathy
Copy link

aurotripathy commented Jan 15, 2025

Description

I'm getting these errors.
Unable to determine why (since I'm in a isolated conda env)

pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for <class 'starlette.requests.Request'>. Set `arbitrary_types_allowed=True` in the model_config to ignore this error or implement `__get_pydantic_core_schema__` on your type to fully support it.

If you got this error by calling handler(<some type>) within `__get_pydantic_core_schema__` then you likely need to call `handler.generate_schema(<some type>)` since we do not call `__get_pydantic_core_schema__` on `<some type>` otherwise to avoid infinite recursion.

For further information visit https://errors.pydantic.dev/2.9/u/schema-for-unknown-type
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/furiosa/.local/lib/python3.10/site-packages/pydantic/type_adapter.py", line 279, in _init_core_attrs
    self._core_schema = _getattr_no_parents(self._type, '__pydantic_core_schema__')
  File "/home/furiosa/.local/lib/python3.10/site-packages/pydantic/type_adapter.py", line 121, in _getattr_no_parents
    raise AttributeError(attribute)
AttributeError: __pydantic_core_schema__

Workaround I found here was to downgrade fastapi from 0.114.0 to 0.111.0

Downgrading fastapi can solve the problem e.g.:

pip install fastapi==0.111.0

Reproduction steps

Just invoked the app locally:
`python app.py`

Screenshots

![DESCRIPTION](LINK.png)

Logs

No response

Browsers

No response

OS

No response

Additional information

No response

@aurotripathy aurotripathy added the bug Something isn't working label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant