diff --git a/plugins/platforms/telegram/adapter.py b/plugins/platforms/telegram/adapter.py index e816bbcbf2cc..edced41f016c 100644 --- a/plugins/platforms/telegram/adapter.py +++ b/plugins/platforms/telegram/adapter.py @@ -1781,6 +1781,18 @@ async def _handle_polling_network_error(self, error: Exception) -> None: await self._drain_polling_connections() + # Guard against self._app being torn down by the supervisor while + # we were sleeping during the reconnect delay. The stop() call + # above is already guarded but start_polling() was not — accessing + # self._app.updater when self._app is None raises AttributeError + # and silently kills the reconnect loop. (#55992) + if not self._app or not self._app.updater: + logger.warning( + "[%s] Telegram app destroyed during reconnect delay (attempt %d) — aborting", + self.name, attempt, + ) + return + try: await self._app.updater.start_polling( allowed_updates=Update.ALL_TYPES,