Pyrogram authenticating issue

Problem description:
While working with pyrogram it gives a keyerror=0 which I believe is just related to replit.

Expected behavior:
It must contact with pyrogram for authenticating and Create 2 Auth files.

Actual behavior:
Does not contact with pyrogram and creates only 1 auth file.

Steps to reproduce:

Bug appears at this link:


Hi @ArminFaiom sorry for the delay in responding to this. I notice you’ve been waiting a while for a reply.

Can you please provide more information to help support when they are able to investigate? For example a link to your Repl or, if you can’t do that, screenshots / a Loom video of the error?



Hi Ian.
Thank you for responding to my email.
Here is the Error I am facing.
I will look forward to hearing from you for further guidance.

Do you have Secrets in your repl?

1 Like

Same problem. It looks like cannot connect to Telegram server, but when I check the port in my repl, it works.
My code also perfectly works from Windows cmd. What is it that makes my code run with differently?

Welcome to Ask! It is possible that Replit has blocked the Telegram server. I don’t know the list or URLs but I know Replit blocks accessing certain websites from a Repl.

Like blocking certain functions? Would be great to know .
Firstly, I see INFO that I am to connected to DC2 server, then next: Retrying due to Keyerror 0.

1 Like

The DC2 port connection is working (pls see first white row).
This error occurs with both user bot libraries: pyrogram and telethon.
However, aiogram library works (it does not require creating a connection session with your phone number and hash key)

Please try using pyprogram-repl in place of pyprogram. Replit blocks outbound traffic on non-standard ports, so there’s a fork of the library that was edited to be compatible with Replit.