ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl:default Connect call failed
See original GitHub issueContext
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
- Operating System: Ubuntu 20.04.3 LTS (Focal Fossa)
- Python Version: 3.8
- aiogram version: 2.18
- aiohttp version: 3.8.1
- uvloop version (if installed):
Current Behavior
After bot start:
Cause exception while getting updates.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1025, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1010, in create_connection
sock = await self._connect_sock(
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 924, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 496, in sock_connect
return await fut
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 528, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
TimeoutError: [Errno 110] Connect call failed ('149.154.167.220', 443)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiogram/bot/api.py", line 139, in make_request
async with session.post(url, data=req, **kwargs) as response:
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 1138, in __aenter__
self._resp = await self._coro
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 535, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 542, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 907, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl:default [Connect call failed ('149.154.167.220', 443)]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiogram/dispatcher/dispatcher.py", line 381, in start_polling
updates = await self.bot.get_updates(
File "/usr/local/lib/python3.8/site-packages/aiogram/bot/bot.py", line 110, in get_updates
result = await self.request(api.Methods.GET_UPDATES, payload)
File "/usr/local/lib/python3.8/site-packages/aiogram/bot/base.py", line 231, in request
return await api.make_request(await self.get_session(), self.server, self.__token, method, data, files,
File "/usr/local/lib/python3.8/site-packages/aiogram/bot/api.py", line 142, in make_request
raise exceptions.NetworkError(f"aiohttp client throws an error: {e.__class__.__name__}: {e}")
aiogram.utils.exceptions.NetworkError: Aiohttp client throws an error: ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl:default [Connect call failed ('149.154.167.220', 443)]
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Cannot connect to host api.telegram.org:443 ssl:default
gaierror: [Errno -3] Temporary failure in name resolution there is an issue in getting the address info for the host. I'd start with...
Read more >Cannot connect to host api.telegram.org:443 ssl:default ...
Hello Everyone. I want to choose pythonanywhere for my chat telegram bot, but I have 1 error after start my python script.
Read more >Cannot connect to host hg.mozilla.org:443 ssl:default [None]
raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host hg.mozilla.org:443 ssl:default ...
Read more >Suddenly HASS cannot connect to internet ressources (DNS ...
Error fetching version information from Hassio, Cannot connect to host version.home-assistant.io:443 ssl:default [Connect call failed ...
Read more >Как запустить Telegram бота в Китае? - Хабр Q&A - Habr
NetworkError: Aiohttp client throws an error: ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl:default [Превышен ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The problem is that time on your host machine is different from world time. I have noticed that Google Cloud compute engine doesn’t have any time synchronization services. That explains why the bot works well for two days, and then he starts catching tracebacks.
Yes, it’s ok now. After that time this problem didn’t happen.