3 months ago
2026-07-04 01:24:00,190 Polling error: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot8731375122:AAEny1jkl7pZzLx7YFaPtsnIvnr8-sAXJuY/getUpdates?offset=941347070&timeout=30 (Caused by NewConnectionError("HTTPSConnection(host='api.telegram.org', port=443): Failed to establish a new connection: [Errno 101] Network is unreachable"))
1 Replies
3 months ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • 3 months ago
2 months ago
First, revoke the bot token shown in the question immediately and generate a new one in @BotFather. Telegram treats the token like a password, and the token in this thread is now public. Put the replacement in a Railway secret variable and redeploy; do not post the new token here. Telegram's official guide confirms that a token can be revoked through @BotFather: https://core.telegram.org/bots/tutorial
The current exception happens before Telegram can validate the token:
[Errno 101] Network is unreachableRailway's outbound-networking documentation calls out this exact error for an IPv6 connection while outbound IPv6 is disabled. Outbound IPv6 is opt-in per service and enabling it keeps IPv4 enabled too: https://docs.railway.com/networking/outbound-networking#outbound-ipv6
api.telegram.org publishes both IPv4 and IPv6 addresses, so the quickest safe fix/test is:
- Open the bot service in Railway.
- Go to Settings -> Networking.
- Enable Outbound IPv6.
- Redeploy the service so the setting takes effect.
- From the new deployment's shell, test both paths without putting the bot token in the command:
getent ahosts api.telegram.org
curl -4 -I --connect-timeout 10 https://api.telegram.org
curl -6 -I --connect-timeout 10 https://api.telegram.orgAny HTTP response proves that family can reach Telegram; the root URL does not need a bot token for this connectivity test.
If IPv4 works but IPv6 fails before the setting change, the DNS/address-family choice explains the polling failure and enabling outbound IPv6 should fix it. If both commands still fail after the redeploy, this is an outbound path problem rather than a Telegram library or polling bug. In that case, post the new deployment ID, region, timestamp, and the sanitized curl -4/curl -6 results so Railway can inspect the egress path. Do not include the replacement token.
Once networking works, keep only one polling process/replica for this bot. Multiple getUpdates pollers would produce a Telegram 409 Conflict, but that is different from the present Network is unreachable error.