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

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

Open
3 tasks done
PalashMudi opened this issue Oct 2, 2023 · 17 comments
Open
3 tasks done

Comments

@PalashMudi
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

2023-10-02T05:17:28.266812+00:00 heroku[worker.1]: State changed from crashed to starting
2023-10-02T05:17:31.769839+00:00 heroku[worker.1]: Starting process with command python3 bot.py
2023-10-02T05:17:32.339762+00:00 heroku[worker.1]: State changed from starting to up
2023-10-02T05:17:33.896266+00:00 app[worker.1]: Traceback (most recent call last):
2023-10-02T05:17:33.896295+00:00 app[worker.1]: File "/app/bot.py", line 33, in
2023-10-02T05:17:33.896351+00:00 app[worker.1]: app.start()
2023-10-02T05:17:33.896360+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/sync.py", line 66, in async_to_sync_wrap
2023-10-02T05:17:33.896405+00:00 app[worker.1]: return loop.run_until_complete(coroutine)
2023-10-02T05:17:33.896406+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
2023-10-02T05:17:33.896506+00:00 app[worker.1]: return future.result()
2023-10-02T05:17:33.896507+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/methods/utilities/start.py", line 58, in start
2023-10-02T05:17:33.896544+00:00 app[worker.1]: is_authorized = await self.connect()
2023-10-02T05:17:33.896545+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/methods/auth/connect.py", line 47, in connect
2023-10-02T05:17:33.896579+00:00 app[worker.1]: await self.session.start()
2023-10-02T05:17:33.896580+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/session/session.py", line 142, in start
2023-10-02T05:17:33.896633+00:00 app[worker.1]: raise e
2023-10-02T05:17:33.896633+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/session/session.py", line 109, in start
2023-10-02T05:17:33.896671+00:00 app[worker.1]: await self.send(raw.functions.Ping(ping_id=0), timeout=self.START_TIMEOUT)
2023-10-02T05:17:33.896672+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/session/session.py", line 333, in send
2023-10-02T05:17:33.896730+00:00 app[worker.1]: raise BadMsgNotification(result.error_code)
2023-10-02T05:17:33.896746+00:00 app[worker.1]: pyrogram.errors.BadMsgNotification: [16] The msg_id is too low, the client time has to be synchronized.
2023-10-02T05:17:34.592533+00:00 heroku[worker.1]: Process exited with status 1
2023-10-02T05:17:34.614877+00:00 heroku[worker.1]: State changed from up to crashed

Steps to reproduce

repo : https://github.com/PalashMudi/Premium-Rename-Bot.

Code example

No response

Logs

2023-10-02T05:17:28.266812+00:00 heroku[worker.1]: State changed from crashed to starting
2023-10-02T05:17:31.769839+00:00 heroku[worker.1]: Starting process with command `python3 bot.py`
2023-10-02T05:17:32.339762+00:00 heroku[worker.1]: State changed from starting to up
2023-10-02T05:17:33.896266+00:00 app[worker.1]: Traceback (most recent call last):
2023-10-02T05:17:33.896295+00:00 app[worker.1]:   File "/app/bot.py", line 33, in <module>
2023-10-02T05:17:33.896351+00:00 app[worker.1]:     app.start()
2023-10-02T05:17:33.896360+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/sync.py", line 66, in async_to_sync_wrap
2023-10-02T05:17:33.896405+00:00 app[worker.1]:     return loop.run_until_complete(coroutine)
2023-10-02T05:17:33.896406+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
2023-10-02T05:17:33.896506+00:00 app[worker.1]:     return future.result()
2023-10-02T05:17:33.896507+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/methods/utilities/start.py", line 58, in start
2023-10-02T05:17:33.896544+00:00 app[worker.1]:     is_authorized = await self.connect()
2023-10-02T05:17:33.896545+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/methods/auth/connect.py", line 47, in connect
2023-10-02T05:17:33.896579+00:00 app[worker.1]:     await self.session.start()
2023-10-02T05:17:33.896580+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/session/session.py", line 142, in start
2023-10-02T05:17:33.896633+00:00 app[worker.1]:     raise e
2023-10-02T05:17:33.896633+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/session/session.py", line 109, in start
2023-10-02T05:17:33.896671+00:00 app[worker.1]:     await self.send(raw.functions.Ping(ping_id=0), timeout=self.START_TIMEOUT)
2023-10-02T05:17:33.896672+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/session/session.py", line 333, in send
2023-10-02T05:17:33.896730+00:00 app[worker.1]:     raise BadMsgNotification(result.error_code)
2023-10-02T05:17:33.896746+00:00 app[worker.1]: pyrogram.errors.BadMsgNotification: [16] The msg_id is too low, the client time has to be synchronized.
2023-10-02T05:17:34.592533+00:00 heroku[worker.1]: Process exited with status 1
2023-10-02T05:17:34.614877+00:00 heroku[worker.1]: State changed from up to crashed
@KurimuzonAkuma
Copy link

Why you opened this issue? Sync your time 🤨🤨🤨

@PalashMudi
Copy link
Author

Why you opened this issue? Sync your time 🤨🤨🤨

after sync time not resolved.

@KurimuzonAkuma
Copy link

Why you opened this issue? Sync your time 🤨🤨🤨

after sync time not resolved.

How you sync time?

@PalashMudi PalashMudi reopened this Oct 6, 2023
@PalashMudi
Copy link
Author

Why you opened this issue? Sync your time 🤨🤨🤨

after sync time not resolved.

How you sync time?

through win+R... >
timedate.cpl >
Internet time >
time.windows.com >
synchronize

@Danstiv
Copy link
Contributor

Danstiv commented Oct 6, 2023

time.windows.com >
synchronize

Are you sure the synchronization is working?
Try checking here: https://www.ntp-servers.net/
Sorry, it seems this resource is only in Russian, but I did not find a similar service in English.

@Danstiv
Copy link
Contributor

Danstiv commented Oct 6, 2023

and...
As I see from the logs, you are running your bot on the Heroku platform, in which case you should make sure that the time is set correctly on that server.
Unfortunately, I can’t quickly come up with a way to check the correctness of the time, because, as far as I know, you cannot connect there via ssh or gain full access in any other way.
Alternatively, you can write a small web server to which you can send a timestamp from a machine on which the time is set correctly, log the timestamp in your endpoint, and then compare them; a difference of 2-3 seconds should not be critical.

@PalashMudi
Copy link
Author

and... As I see from the logs, you are running your bot on the Heroku platform, in which case you should make sure that the time is set correctly on that server. Unfortunately, I can’t quickly come up with a way to check the correctness of the time, because, as far as I know, you cannot connect there via ssh or gain full access in any other way. Alternatively, you can write a small web server to which you can send a timestamp from a machine on which the time is set correctly, log the timestamp in your endpoint, and then compare them; a difference of 2-3 seconds should not be critical.

solved by updating python and required library. but now came another errror...

pyrogram.errors.exceptions.not_acceptable_406.AuthKeyDuplicated: Telegram says: [406 AUTH_KEY_DUPLICATED] - The same authorization key (session file) was used in more than one place simultaneously. You must delete your session file and log in again with your phone number or bot token (caused by "InvokeWithLayer")

@KurimuzonAkuma
Copy link

and... As I see from the logs, you are running your bot on the Heroku platform, in which case you should make sure that the time is set correctly on that server. Unfortunately, I can’t quickly come up with a way to check the correctness of the time, because, as far as I know, you cannot connect there via ssh or gain full access in any other way. Alternatively, you can write a small web server to which you can send a timestamp from a machine on which the time is set correctly, log the timestamp in your endpoint, and then compare them; a difference of 2-3 seconds should not be critical.

solved by updating python and required library. but now came another errror...

pyrogram.errors.exceptions.not_acceptable_406.AuthKeyDuplicated: Telegram says: [406 AUTH_KEY_DUPLICATED] - The same authorization key (session file) was used in more than one place simultaneously. You must delete your session file and log in again with your phone number or bot token (caused by "InvokeWithLayer")

Everything is written in the error. Read more than the first two words

@dkpapp
Copy link

dkpapp commented Oct 7, 2023

and... As I see from the logs, you are running your bot on the Heroku platform, in which case you should make sure that the time is set correctly on that server. Unfortunately, I can’t quickly come up with a way to check the correctness of the time, because, as far as I know, you cannot connect there via ssh or gain full access in any other way. Alternatively, you can write a small web server to which you can send a timestamp from a machine on which the time is set correctly, log the timestamp in your endpoint, and then compare them; a difference of 2-3 seconds should not be critical.

solved by updating python and required library. but now came another errror...

pyrogram.errors.exceptions.not_acceptable_406.AuthKeyDuplicated: Telegram says: [406 AUTH_KEY_DUPLICATED] - The same authorization key (session file) was used in more than one place simultaneously. You must delete your session file and log in again with your phone number or bot token (caused by "InvokeWithLayer")

Upgraded to which version and which library upgraded please reply because same error

@i701
Copy link

i701 commented Oct 8, 2023

Upgrade to Pyrogram latest version. It should fix the issue. Install version 2.0.106

The releases page in github is not updated.

@purnima200
Copy link

Just run this in your terminal to know exact time and date $ date ; date +"%FORMAT" ; var=$(date) ; var=date ; echo "$var";

@aaron0713
Copy link

Upgrade to 2.0.106

@mdmeds123
Copy link

after changed the pyrogram 1.xxx version to 2.xxx in requirements.txt, I have no more issues. thx a lot guys😁

@HiddenLights
Copy link

Is there a way of still using the pyrogram version 1.4.16 and fix this "error [16]"?

@ZhymabekRoman
Copy link

Is there a way of still using the pyrogram version 1.4.16 and fix this "error [16]"?

Upgrade your Pyrogram

@Helias
Copy link

Helias commented Feb 19, 2024

as I wrote here I've solved upgrading pyrogram. I got this issue after 25 December 2023

@CodeOfDestruction
Copy link

Is there a way of still using the pyrogram version 1.4.16 and fix this "error [16]"?

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