3bl3gamer / tgclient

Telegram (mtproto) client written in golang
MIT License
19 stars 5 forks source link

mtproto.TL_badMsgNotification{BadMsgID:7392862090884919560, BadMsgSeqno:1, ErrorCode:32 #28

Open wind-hx opened 4 months ago

wind-hx commented 4 months ago

I upgraded to the latest code. This error occurs when using the sendMessage method after layer 183.

https://core.telegram.org/mtproto/service_messages_about_messages

msg_seqno too low (the server has already received a message with a lower msg_id but with either a higher or an equal and odd seqno)

wind-hx commented 4 months ago

Judging from the error log printed on the console, it is an error that occurred during connect.

3bl3gamer commented 4 months ago

This error occurs when using the sendMessage

it is an error that occurred during connect

Does it happen both while sending message and while connecting?

Does it happen during the first connection or during a reconnection (as in https://github.com/3bl3gamer/tgclient/issues/27)? Is this reconnection caused by some other error?

Is there a way to reliably reproduce this error? I've tried to reconnect and send message multiple times, it worked OK for me.

wind-hx commented 4 months ago

When the AUTH_KEY_DUPLICATED error occurs during initConnect, there is no need to try to reconnect, because the "mtproto.TL_badMsgNotification{BadMsgID:7392862090884919560, BadMsgSeqno:1, ErrorCode:32" error will appear when reconnecting.

wind-hx commented 4 months ago

https://core.telegram.org/api/errors

If the client receives an AUTH_KEY_DUPLICATED error, the session was already invalidated by the server and the user must generate a new auth key and login again.

Program errors when client receives AUTH_KEY_DUPLICATED error

3bl3gamer commented 4 months ago

When the AUTH_KEY_DUPLICATED error occurs during initConnect, there is no need to try to reconnect

I agree. But does TL_badMsgNotification{ErrorCode:32} only occur after AUTH_KEY_DUPLICATED? If so, there seems no need to check ErrorCode:32/33 and try to recover (as in https://github.com/3bl3gamer/tgclient/pull/29)? Since it will not be possible to recover (without re-auth) anyway. And during normal operation there should be no errors with ErrorCode:32/33.

wind-hx commented 4 months ago

"ErrorCode:32/33" This error does not need to be handled, but I referred to "https://github.com/gram-js/gramjs/blob/9233537e172ffce6d44a09454b7c75369a846bbf/gramjs/network/MTProtoSender.ts#L856" This part of the code

wind-hx commented 4 months ago

There is no need to check "ErrorCode:32/33", I just referred to the "GramJS" project