LonamiWebs / Telethon

Pure Python 3 MTProto API Telegram client library, for bots too!
https://docs.telethon.dev
MIT License
9.94k stars 1.4k forks source link

Could not find a matching Constructor ID for the TLObject that was supposed to be read with ID 904dd49c #4240

Closed Rongronggg9 closed 11 months ago

Rongronggg9 commented 11 months ago

Code that causes the issue

The bug occurs very frequently (10~60 times/hour) on the public demo of https://github.com/Rongronggg9/RSS-to-Telegram-Bot (https://t.me/RSStT_Bot). I can not reproduce the bug locally at all.

Expected behavior

No warning and Telethon does not disconnect automatically.

Actual behavior

The warning appears frequently and Telethon immediately disconnects. Delete the existing session and let Telethon create a brand-new one does not help any.

2023-11-07-15:17:50:WARNING:telethon.client.updates - Cannot get difference since the account is likely misusing the session: Could not find a matching Constructor ID for the TLObject that was supposed to be read with ID 904dd49c. See the FAQ for more details. Remaining bytes: [REDACTED]
[Telethon disconnected]

Traceback

No response

Telethon version

1.32.0

Python version

3.11.6

Operating system (including distribution name and version)

Debian bookworm

Other details

The remaining bytes are redacted since they seem to contain private information of bot users. In case they are needed, I am glad to send them via email.

Checklist

Lonami commented 11 months ago

I ran git rev-list --all | xargs git grep 904dd49c on the tdesktop repository (as suggested) and did not find any results. So I really have no idea what that constructor was. Maybe an unreleased layer, somehow.

on the public demo

Does this somehow mean there's a single session being used from multiple places?

Rongronggg9 commented 11 months ago

Does this somehow mean there's a single session being used from multiple places?

Nope.

Rongronggg9 commented 11 months ago

I can not reproduce the bug locally at all.

Ahh, I meant that I couldn't reproduce the bug locally with another bot token. I am unable to run the public demo locally as its database is on my VPS. I don't want to connect to it through the Internet.

Lonami commented 11 months ago

It is very unlikely this is a problem that can be fixed on Telethon's side. The FAQ explains why this happens and that's still the best guess to my knowledge. Telegram sending a constructor that's nowhere to be seen in tdesktop's source is strange. No idea what to do about it though, but it being a "public demo" seems suspicious.

Strafer14 commented 11 months ago

I also have an issue with this exact error suddenly with my bot that listens to channels in the last few days 🤔 I'm using the latest version of Telethon (1.32.0)

Lonami commented 11 months ago

Then Telegram may have messed something up. It is not the first time they've published a layer number, but then made changes to it (without changing the number). If that's the case, the only thing you can do is wait or temporarily downgrade.

emilio-cea commented 11 months ago

I want to clarify this as well as this was also happening to me, not using the bot API tho.

Does this somehow mean there's a single session being used from multiple places?

After reading the FAQ as @Lonami mentioned I realized I was using a session in 2 different places, so you might want to check that out!

teidesu commented 11 months ago

it was added in https://github.com/tdlib/td/commit/3c64604acce20e1794decc4cd5be459fa8ea0c1a without bumping layer number for some reason

only seems to be present in tdlib schema

updateBotChatBoost#904dd49c peer:Peer boost:Boost qts:int = Update;
Lonami commented 11 months ago

Thanks. Then the "problem" (just a log message) will be solved once a new layer is made available.