You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Import failes with the exception provided in the logs.
Steps to reproduce
Create a virtual enviroment with any supported version of python.
Install a fresh version of aiogram (3.1.0) - pip install aiogram
Import Bot from aiogram - from aiogram import Bot
Catch the exception.
Code example
fromaiogramimportBot
Logs
Traceback (most recent call last):
File "/root/workzilla-tg-bot/main.py", line 5, in<module>
import bot
File "/root/workzilla-tg-bot/bot.py", line 3, in<module>
from aiogram import Bot
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/aiogram/__init__.py", line 5, in<module>
from . import enums, methods, types
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/aiogram/methods/__init__.py", line 6, in<module>
from .answer_web_app_query import AnswerWebAppQuery
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/aiogram/methods/answer_web_app_query.py", line 31, in<module>
class AnswerWebAppQuery(TelegramMethod[SentWebAppMessage]):
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 184, in __new__
complete_model_class(
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 495, in complete_model_class
schema = apply_discriminators(simplify_schema_references(schema))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 519, in simplify_schema_references
schema = walk_core_schema(schema, count_refs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 439, in walk_core_schema
return f(schema, _dispatch)
^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 515, in count_refs
recurse(state['definitions'][ref], count_refs)
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 215, in walk
return f(schema, self._walk)
^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 503, in count_refs
return recurse(s, count_refs)
^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 218, in _walk
schema = self._schema_type_to_method[schema['type']](schema, f)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 227, in _handle_other_schemas
schema['schema'] = self.walk(sub_schema, f) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 215, in walk
return f(schema, self._walk)
^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 503, in count_refs
return recurse(s, count_refs)
^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 218, in _walk
schema = self._schema_type_to_method[schema['type']](schema, f)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 227, in _handle_other_schemas
schema['schema'] = self.walk(sub_schema, f) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 215, in walk
return f(schema, self._walk)
^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 503, in count_refs
return recurse(s, count_refs)
^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 218, in _walk
schema = self._schema_type_to_method[schema['type']](schema, f)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 362, in handle_model_fields_schema
replaced_field['schema'] = self.walk(v['schema'], f)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 215, in walk
return f(schema, self._walk)
^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 503, in count_refs
return recurse(s, count_refs)
^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 218, in _walk
schema = self._schema_type_to_method[schema['type']](schema, f)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 323, in handle_union_schema
new_choices.append(self.walk(v, f))
^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 215, in walk
return f(schema, self._walk)
^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 515, in count_refs
recurse(state['definitions'][ref], count_refs)
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 218, in _walk
schema = self._schema_type_to_method[schema['type']](schema, f)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 227, in _handle_other_schemas
schema['schema'] = self.walk(sub_schema, f) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 215, in walk
return f(schema, self._walk)
^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 503, in count_refs
return recurse(s, count_refs)
^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 218, in _walk
schema = self._schema_type_to_method[schema['type']](schema, f)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 227, in _handle_other_schemas
schema['schema'] = self.walk(sub_schema, f) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 215, in walk
return f(schema, self._walk)
^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 503, in count_refs
return recurse(s, count_refs)
^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 218, in _walk
schema = self._schema_type_to_method[schema['type']](schema, f)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 362, in handle_model_fields_schema
replaced_field['schema'] = self.walk(v['schema'], f)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 215, in walk
return f(schema, self._walk)
^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 503, in count_refs
return recurse(s, count_refs)
^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 218, in _walk
schema = self._schema_type_to_method[schema['type']](schema, f)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 227, in _handle_other_schemas
schema['schema'] = self.walk(sub_schema, f) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 215, in walk
return f(schema, self._walk)
^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 503, in count_refs
return recurse(s, count_refs)
^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 218, in _walk
schema = self._schema_type_to_method[schema['type']](schema, f)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 227, in _handle_other_schemas
schema['schema'] = self.walk(sub_schema, f) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 215, in walk
return f(schema, self._walk)
^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 503, in count_refs
return recurse(s, count_refs)
^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 218, in _walk
schema = self._schema_type_to_method[schema['type']](schema, f)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 323, in handle_union_schema
new_choices.append(self.walk(v, f))
^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 215, in walk
return f(schema, self._walk)
^^^^^^^^^^^^^^^^^^^^^
File "/root/workzilla-tg-bot/.venv/lib/python3.11/site-packages/pydantic/_internal/_core_utils.py", line 515, in count_refs
recurse(state['definitions'][ref], count_refs)
~~~~~~~~~~~~~~~~~~~~^^^^^
KeyError: 'aiogram.types.input_text_message_content.InputTextMessageContent:32048144'
Additional information
Also tested on Ubuntu 22.04 with python 3.9/3.10/3.11. Same error.
To solve this error you just need to downgrade pydantic version from 2.4.0 to 2.3.0.
The text was updated successfully, but these errors were encountered:
Checklist
Operating system
Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-155-generic x86_64) / 22.04
Python version
3.11.5
aiogram version
3.1.0/3.0.0
Expected behavior
Correct import of Bot from aiogram.
Current behavior
Import failes with the exception provided in the logs.
Steps to reproduce
pip install aiogram
from aiogram import Bot
Code example
Logs
Additional information
Also tested on Ubuntu 22.04 with python 3.9/3.10/3.11. Same error.
To solve this error you just need to downgrade pydantic version from 2.4.0 to 2.3.0.
The text was updated successfully, but these errors were encountered: