Summary
After a successful QR + 2FA login, tgcli may print an alarming warning:
[WRN] [updates] [USER redacted] error fetching common difference: Error: Session is reset
at MtprotoSession.resetState (...)
at SessionConnection.destroy (...)
at async NetworkManager.destroy (...)
at async MtClient.disconnect (...)
The same warning is reproducible with tgcli doctor --connect.
Authentication remains valid and live Telegram requests succeed, so this appears to be an expected shutdown cancellation being logged as a warning rather than an actual session failure.
Environment
- tgcli 2.2.3
- Homebrew installation
- Node.js 22
- macOS
Steps to reproduce
- Run
tgcli auth --qr --qr-file /tmp/tgcli-auth.png.
- Scan the QR code and enter the 2FA password.
- Observe
Session is reset while the command shuts down.
Alternative reproduction:
Current behavior
The command reports a valid connection:
AUTHENTICATED: true
CONNECTED: true
A subsequent read-only request also succeeds:
tgcli --json channels list --limit 1
However, client teardown can log error fetching common difference: Error: Session is reset, which makes a successful login look broken.
Expected behavior
Expected cancellation of an in-flight updates/difference request during intentional client shutdown should be suppressed or downgraded to debug-level output.
Real session resets outside intentional shutdown should remain visible and retain the existing recovery behavior.
Likely cause
TelegramClient.destroy() disconnects mtcute while the updates manager has a common-difference request in flight. MtprotoSession.resetState() rejects pending RPCs with MtcuteError("Session is reset"), and the updates manager logs that rejection as a warning.
Possible direction
Track intentional shutdown and suppress only this expected teardown error, or stop the updates manager cleanly before destroying the MTProto client. Avoid broadly hiding Session is reset, since tgcli already uses it for genuine recovery paths.
Summary
After a successful QR + 2FA login,
tgclimay print an alarming warning:The same warning is reproducible with
tgcli doctor --connect.Authentication remains valid and live Telegram requests succeed, so this appears to be an expected shutdown cancellation being logged as a warning rather than an actual session failure.
Environment
Steps to reproduce
tgcli auth --qr --qr-file /tmp/tgcli-auth.png.Session is resetwhile the command shuts down.Alternative reproduction:
Current behavior
The command reports a valid connection:
A subsequent read-only request also succeeds:
However, client teardown can log
error fetching common difference: Error: Session is reset, which makes a successful login look broken.Expected behavior
Expected cancellation of an in-flight updates/difference request during intentional client shutdown should be suppressed or downgraded to debug-level output.
Real session resets outside intentional shutdown should remain visible and retain the existing recovery behavior.
Likely cause
TelegramClient.destroy()disconnects mtcute while the updates manager has a common-difference request in flight.MtprotoSession.resetState()rejects pending RPCs withMtcuteError("Session is reset"), and the updates manager logs that rejection as a warning.Possible direction
Track intentional shutdown and suppress only this expected teardown error, or stop the updates manager cleanly before destroying the MTProto client. Avoid broadly hiding
Session is reset, since tgcli already uses it for genuine recovery paths.