Closed melardev closed 1 year ago
Your log does not match with the current line numbers in the development version, so I suspect you did not actually complete this step:
I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip and triggered the bug in the latest version.
Because this should've been fixed by https://github.com/LonamiWebs/Telethon/commit/2889bd5bf36a792e0de696b3f7794ba7ba16cfe5.
Hi. I actually ran it yesterday, and today to be sure, I first uninstalled telethon:
pip3 uninstall telethon
Then installed it with:
pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip
I still see the error:
telethon.errors.common.TypeNotFoundError: Could not find a matching Constructor ID for the TLObject that was supposed to be read with ID b156fe9c. See the FAQ for more details. Remaining bytes:
Stack trace (Just first exception, there are other exceptions that were triggered as a consequence but did not show them here):
--- Logging error ---
Traceback (most recent call last):
File "/home/laro/Desktop/workspace/python/update-monitor/venv/lib/python3.10/site-packages/telethon/client/updates.py", line 347, in _update_loop
diff = await self(get_diff)
File "/home/laro/Desktop/workspace/python/update-monitor/venv/lib/python3.10/site-packages/telethon/client/users.py", line 30, in __call__
return await self._call(self._sender, request, ordered=ordered)
File "/home/laro/Desktop/workspace/python/update-monitor/venv/lib/python3.10/site-packages/telethon/client/users.py", line 87, in _call
result = await future
File "/home/laro/Desktop/workspace/python/update-monitor/venv/lib/python3.10/site-packages/telethon/network/mtprotosender.py", line 639, in _handle_rpc_result
result = state.request.read_result(reader)
File "/home/laro/Desktop/workspace/python/update-monitor/venv/lib/python3.10/site-packages/telethon/tl/tlobject.py", line 219, in read_result
return reader.tgread_object()
File "/home/laro/Desktop/workspace/python/update-monitor/venv/lib/python3.10/site-packages/telethon/extensions/binaryreader.py", line 142, in tgread_object
return clazz.from_reader(self)
File "/home/laro/Desktop/workspace/python/update-monitor/venv/lib/python3.10/site-packages/telethon/tl/types/updates.py", line 72, in from_reader
_x = reader.tgread_object()
File "/home/laro/Desktop/workspace/python/update-monitor/venv/lib/python3.10/site-packages/telethon/extensions/binaryreader.py", line 142, in tgread_object
return clazz.from_reader(self)
File "/home/laro/Desktop/workspace/python/update-monitor/venv/lib/python3.10/site-packages/telethon/tl/types/__init__.py", line 30321, in from_reader
_message = reader.tgread_object()
File "/home/laro/Desktop/workspace/python/update-monitor/venv/lib/python3.10/site-packages/telethon/extensions/binaryreader.py", line 142, in tgread_object
return clazz.from_reader(self)
File "/home/laro/Desktop/workspace/python/update-monitor/venv/lib/python3.10/site-packages/telethon/tl/types/__init__.py", line 16403, in from_reader
_reactions = reader.tgread_object()
File "/home/laro/Desktop/workspace/python/update-monitor/venv/lib/python3.10/site-packages/telethon/extensions/binaryreader.py", line 142, in tgread_object
return clazz.from_reader(self)
File "/home/laro/Desktop/workspace/python/update-monitor/venv/lib/python3.10/site-packages/telethon/tl/types/__init__.py", line 19209, in from_reader
_x = reader.tgread_object()
File "/home/laro/Desktop/workspace/python/update-monitor/venv/lib/python3.10/site-packages/telethon/extensions/binaryreader.py", line 140, in tgread_object
raise error
Scrolling to the top, seems there are multiple similar exceptions but from different messages ( I can spot some ascii in the binari data and it belongs to different messages/channels), all error messages same except:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.10/logging/__init__.py", line 1100, in emit
msg = self.format(record)
File "/usr/lib/python3.10/logging/__init__.py", line 943, in format
return fmt.format(record)
File "/usr/lib/python3.10/logging/__init__.py", line 678, in format
record.message = record.getMessage()
File "/usr/lib/python3.10/logging/__init__.py", line 368, in getMessage
msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
File "/home/laro/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/231.9011.38/plugins/python/helpers/pydev/pydevd.py", line 2195, in <module>
main()
File "/home/laro/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/231.9011.38/plugins/python/helpers/pydev/pydevd.py", line 2177, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/laro/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/231.9011.38/plugins/python/helpers/pydev/pydevd.py", line 1489, in run
return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
File "/home/laro/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/231.9011.38/plugins/python/helpers/pydev/pydevd.py", line 1496, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/laro/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/231.9011.38/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/laro/Desktop/workspace/python/update-monitor/monitor_calls.py", line 313, in <module>
client.run_until_disconnected()
File "/home/laro/Desktop/workspace/python/update-monitor/venv/lib/python3.10/site-packages/telethon/client/updates.py", line 95, in run_until_disconnected
return self.loop.run_until_complete(self._run_until_disconnected())
File "/usr/lib/python3.10/asyncio/base_events.py", line 633, in run_until_complete
self.run_forever()
File "/usr/lib/python3.10/asyncio/base_events.py", line 600, in run_forever
self._run_once()
File "/usr/lib/python3.10/asyncio/base_events.py", line 1896, in _run_once
handle._run()
File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/laro/Desktop/workspace/python/update-monitor/venv/lib/python3.10/site-packages/telethon/client/updates.py", line 365, in _update_loop
self._log[__name__].warning(
Message: 'Cannot get difference since the account is likely misusing the session: %s'
Arguments: (1728102358, TypeNotFoundError('Could not find a matching Constructor ID for the TLObject that was supposed to be read with ID b156fe9c.
TypeError: not all arguments converted during string formatting
That is a bug which https://github.com/LonamiWebs/Telethon/commit/c3bddf9440ab4273c89ef474f79022064b8d1a83 should fix.
telethon.errors.common.TypeNotFoundError: Could not find a matching Constructor ID for the TLObject that was supposed to be read with ID b156fe9c. See the FAQ for more details.
This is now working as intended. Before, the library would swallow the error and crash. Now it's propagated and you can handle it and do whatever is best. And as mentioned, the FAQ contains some additional information.
Code that causes the issue
Hi, I am having an error listening to some telegram messages.
It crashes the whole app. I have seen others reported this bug past years, telethon version used is latest.
The code is standard, I can not show it all as it has some private things including private channels:
Expected behavior
Work without error
Actual behavior
App crash
Traceback
Telethon version
1.28.5
Python version
3.10.6
Operating system
Linux
Other details
No response
Checklist
pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip
and triggered the bug in the latest version.