Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyrogram.errors.BadMsgNotification: [16] The msg_id is too low, the client time has to be synchronized. #1388

Open
3 tasks done
venombolteop opened this issue Jan 18, 2024 · 10 comments

Comments

@venombolteop
Copy link

Checklist

  • I am sure the error is coming from Pyrogram's code and not elsewhere
  • I have searched in the issue tracker for similar bug reports, including closed ones
  • I ran pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip and reproduced the issue using the latest development version

Description

I got this error from yesterday evening. And this error from pyrogram. Error is pyrogram.errors.BadMsgNotification: [16] The msg_id is too low, the client time has to be synchronized. I don't know how solve this please help me.

I use this requirements mention below
python-dotenv==0.20.0
SQLAlchemy==1.4.40
psycopg2-binary
Telethon==1.24.0
pyromod==1.5
pyrogram1==0.*
TgCrypto==1.2.3
pyrogram==2.0.41

Steps to reproduce

I do too much tries to solve this error. But no success. I know that this error from pyrogram.

Code example

import env
import logging
from pyrogram import Client, idle
from pyromod import listen  # type: ignore
from pyrogram.errors import ApiIdInvalid, ApiIdPublishedFlood, AccessTokenInvalid

logging.basicConfig(
    level=logging.WARNING, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)

app = Client(
    "bot",
    api_id=env.API_ID,
    api_hash=env.API_HASH,
    bot_token=env.BOT_TOKEN,
    in_memory=True,
    plugins=dict(root="StringGenBot"),
)


if __name__ == "__main__":
    print("Starting the String Generator Bot...")
    try:
        app.start()
    except (ApiIdInvalid, ApiIdPublishedFlood):
        raise Exception("Your API_ID/API_HASH is not valid.")
    except AccessTokenInvalid:
        raise Exception("Your BOT_TOKEN is not valid.")
    uname = app.get_me().username
    print(f"@{uname} started successfully !")
    idle()
    app.stop()
    print("Bot stopped. Bye !")

Logs

2024-01-18T02:16:07.993102+00:00 app[worker.1]:     await self.session.start()
2024-01-18T02:16:07.993103+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/session/session.py", line 142, in start
2024-01-18T02:16:07.993235+00:00 app[worker.1]:     raise e
2024-01-18T02:16:07.993236+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/session/session.py", line 109, in start
2024-01-18T02:16:07.993326+00:00 app[worker.1]:     await self.send(raw.functions.Ping(ping_id=0), timeout=self.START_TIMEOUT)
2024-01-18T02:16:07.993327+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/session/session.py", line 333, in send
2024-01-18T02:16:07.993448+00:00 app[worker.1]:     raise BadMsgNotification(result.error_code)
2024-01-18T02:16:07.993477+00:00 app[worker.1]: pyrogram.errors.BadMsgNotification: [16] The msg_id is too low, the client time has to be synchronized.
2024-01-18T02:16:08.136270+00:00 heroku[worker.1]: Process exited with status 1
2024-01-18T02:16:08.161165+00:00 heroku[worker.1]: State changed from up to crashed
2024-01-18T02:23:43.681487+00:00 heroku[worker.1]: State changed from crashed to starting
2024-01-18T02:23:47.283336+00:00 heroku[worker.1]: Starting process with command `python3 bot.py`
2024-01-18T02:23:47.982483+00:00 heroku[worker.1]: State changed from starting to up
2024-01-18T02:23:49.586711+00:00 app[worker.1]: Starting the String Generator Bot...
2024-01-18T02:23:51.827099+00:00 app[worker.1]: Traceback (most recent call last):
2024-01-18T02:23:51.827171+00:00 app[worker.1]:   File "/app/bot.py", line 24, in <module>
2024-01-18T02:23:51.827215+00:00 app[worker.1]:     app.start()
2024-01-18T02:23:51.827218+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/sync.py", line 66, in async_to_sync_wrap
2024-01-18T02:23:51.827321+00:00 app[worker.1]:     return loop.run_until_complete(coroutine)
2024-01-18T02:23:51.827321+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
2024-01-18T02:23:51.827519+00:00 app[worker.1]:     return future.result()
2024-01-18T02:23:51.827531+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/methods/utilities/start.py", line 58, in start
2024-01-18T02:23:51.827569+00:00 app[worker.1]:     is_authorized = await self.connect()
2024-01-18T02:23:51.827570+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/methods/auth/connect.py", line 47, in connect
2024-01-18T02:23:51.827638+00:00 app[worker.1]:     await self.session.start()
2024-01-18T02:23:51.827639+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/session/session.py", line 142, in start
2024-01-18T02:23:51.827748+00:00 app[worker.1]:     raise e
2024-01-18T02:23:51.827749+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/session/session.py", line 109, in start
2024-01-18T02:23:51.827807+00:00 app[worker.1]:     await self.send(raw.functions.Ping(ping_id=0), timeout=self.START_TIMEOUT)
2024-01-18T02:23:51.827808+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/session/session.py", line 333, in send
2024-01-18T02:23:51.827926+00:00 app[worker.1]:     raise BadMsgNotification(result.error_code)
2024-01-18T02:23:51.827971+00:00 app[worker.1]: pyrogram.errors.BadMsgNotification: [16] The msg_id is too low, the client time has to be synchronized.
2024-01-18T02:23:51.938590+00:00 heroku[worker.1]: Process exited with status 1
2024-01-18T02:23:51.965590+00:00 heroku[worker.1]: State changed from up to crashed
@officialssohero
Copy link

Hi,
Update your pyrogram version to pyrogram==2.*

It should be fixed ;)

Make sure to update your code accordingly to the new update.

@eisamb
Copy link

eisamb commented Jan 18, 2024

If i dont want to update pyrogram version what can i do to fix it?

@venombolteop
Copy link
Author

Hi, Update your pyrogram version to pyrogram==2.*

It should be fixed ;)

Make sure to update your code accordingly to the new update.

Ok let me check

@Venomhash123
Copy link

Venomhash123 commented Jan 21, 2024

Yes if I not want to update pyrogram version then how can i solve this problem ?
Plz reply
I m using pyrogram 1.4.16

@venombolteop
Copy link
Author

Yes if I not want to update pyrogram version then how can i solve this problem ? Plz reply I m using pyrogram 1.4.16

Update your code to Program 2.0.106. This is the only solution olders versions didn't work.

@Venomhash123
Copy link

Ok

@sarthakkale2004
Copy link

STILLL DIDNT WORK

@venombolteop
Copy link
Author

STILLL DIDNT WORK

Update your code to latest version

@cogscides
Copy link

The same issue here, upgrading doesn't help either. The code seems okay for the v2.

@venombolteop
Copy link
Author

The same issue here, upgrading doesn't help either. The code seems okay for the v2.

Your code also need to upgrade to latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

6 participants