wiz0u / WTelegramClient

Telegram Client API (MTProto) library written 100% in C# and .NET
https://wiz0u.github.io/WTelegramClient/
MIT License
956 stars 156 forks source link

MTPROTO_CLUSTER_INVALID exception #238

Closed vmato closed 6 months ago

vmato commented 6 months ago

After update to the latest version of WTelegramClient we've got new exceptions:

TL.RpcException: 403 MTPROTO_CLUSTER_INVALID
  at WTelegram.Client.Invoke[T] (TL.IMethod`1[ReturnType] query) [0x004a5] in <ed910d9cc699420eaf5d4f042c0212d2>:0
  at WTelegram.Client+<>c__DisplayClass133_0.<DownloadFileAsync>g__LoadPart|0 (System.Int64 offset) [0x00177] in <ed910d9cc699420eaf5d4f042c0212d2>:0
  at WTelegram.Client.DownloadFileAsync (TL.InputFileLocationBase fileLocation, System.IO.Stream outputStream, System.Int32 dc_id, System.Int64 fileSize, WTelegram.Client+ProgressCallback progress) [0x0042e] in <ed910d9cc699420eaf5d4f042c0212d2>:0
  at WTelegram.Client.DownloadFileAsync (TL.Photo photo, System.IO.Stream outputStream, TL.PhotoSizeBase photoSize, WTelegram.Client+ProgressCallback progress) [0x000e9] in <ed910d9cc699420eaf5d4f042c0212d2>:0

How should we handle or workaround them?

wiz0u commented 6 months ago

As far as I can tell, it's an uncommon error, rarely observed. Possibly a temporary server issue, unrelated to library update. 🤷🏻‍♂️ It seems to be about using an invalid (outdated?) IP for connecting to DataCenter.

Maybe you were connected with the library for too long and the valid DataCenters IP addresses changed in the mean time.

My recommendation would be to disconnect (dispose the client), and reconnect (not using quickResume) This will refresh the list of active datacenter (in TLConfig)