danog / MadelineProto

Async PHP client API for the telegram MTProto protocol
https://docs.madelineproto.xyz
GNU Affero General Public License v3.0
2.83k stars 654 forks source link

An invalid ID was specified! #1449

Closed MrParAziT closed 9 months ago

MrParAziT commented 9 months ago

Surfaced: Webmozart\Assert\InvalidArgumentException: An invalid ID was specified! in /var/www/html/files/vendor/webmozart/assert/src/Assert.php:2074 Stack trace:

0 /var/www/html/files/vendor/webmozart/assert/src/Assert.php(635): Webmozart\Assert\Assert::reportInvalidArgument()

1 /var/www/html/files/vendor/danog/madelineproto/src/MTProtoTools/PeerHandler.php(416): Webmozart\Assert\Assert::true()

2 /var/www/html/files/vendor/danog/madelineproto/src/MTProtoTools/PeerHandler.php(338): danog\MadelineProto\MTProto->getInfo()

3 /var/www/html/files/vendor/danog/madelineproto/src/TL/TL.php(583): danog\MadelineProto\MTProto->getInputPeer()

4 /var/www/html/files/vendor/danog/madelineproto/src/TL/TL.php(761): danog\MadelineProto\TL\TL->serializeObject()

5 /var/www/html/files/vendor/danog/madelineproto/src/TL/TL.php(631): danog\MadelineProto\TL\TL->serializeParams()

6 /var/www/html/files/vendor/danog/madelineproto/src/Connection.php(550): danog\MadelineProto\TL\TL->serializeMethod()

7 /var/www/html/files/vendor/danog/madelineproto/src/MTProtoSession/CallHandler.php(198): danog\MadelineProto\Connection->sendMessage()

8 /var/www/html/files/vendor/danog/madelineproto/src/MTProtoSession/CallHandler.php(98): danog\MadelineProto\Connection->methodCallAsyncWrite()

9 /var/www/html/files/vendor/danog/madelineproto/src/MTProtoTools/CallHandler.php(45): danog\MadelineProto\Connection->methodCallAsyncRead()

10 /var/www/html/files/vendor/danog/madelineproto/src/Namespace/AbstractAPI.php(70): danog\MadelineProto\MTProto->methodCallAsyncRead()

11 /var/www/html/files/f2l_bot.php(256): danog\MadelineProto\Namespace\AbstractAPI->__call()

12 /var/www/html/files/vendor/danog/madelineproto/src/EventHandler.php(227): MyEventHandler->handleMessage()

13 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(425): danog\MadelineProto\EventHandler::danog\MadelineProto{closure}()

14 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(616): Revolt\EventLoop\Internal\AbstractDriver->invokeMicrotasks()

15 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal{closure}()

16 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/DriverSuspension.php(64): Fiber->resume()

17 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(425): Revolt\EventLoop\Internal\DriverSuspension::Revolt\EventLoop\Internal{closure}()

18 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(616): Revolt\EventLoop\Internal\AbstractDriver->invokeMicrotasks()

19 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal{closure}()

20 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(498): Fiber->start()

21 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(553): Revolt\EventLoop\Internal\AbstractDriver->invokeCallbacks()

22 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal{closure}()

23 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(94): Fiber->resume()

24 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/DriverSuspension.php(117): Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal{closure}()

25 /var/www/html/files/vendor/amphp/amp/src/Future.php(251): Revolt\EventLoop\Internal\DriverSuspension->suspend()

26 /var/www/html/files/vendor/danog/madelineproto/src/Wrappers/Loop.php(107): Amp\Future->await()

27 /var/www/html/files/vendor/danog/madelineproto/src/AbstractAPI.php(84): danog\MadelineProto\MTProto->loop()

28 /var/www/html/files/vendor/danog/madelineproto/src/AbstractAPI.php(65): danog\MadelineProto\AbstractAPI->startAndLoopLogic()

29 /var/www/html/files/vendor/danog/madelineproto/src/EventHandler.php(100): danog\MadelineProto\AbstractAPI->startAndLoopInternal()

30 /var/www/html/files/f2l_bot.php(315): danog\MadelineProto\EventHandler::startAndLoopBot()

Surfaced: AssertionError: Invalid ID 0 provided! in /var/www/html/files/vendor/danog/madelineproto/src/MTProtoTools/DialogId.php:41 Stack trace:

0 /var/www/html/files/vendor/danog/madelineproto/src/MTProtoTools/DialogId.php(116): danog\MadelineProto\MTProtoTools\DialogId::getType()

1 /var/www/html/files/vendor/danog/madelineproto/src/Connection.php(362): danog\MadelineProto\MTProtoTools\DialogId::isSecretChat()

2 /var/www/html/files/vendor/danog/madelineproto/src/MTProtoSession/CallHandler.php(164): danog\MadelineProto\Connection->methodAbstractions()

3 /var/www/html/files/vendor/danog/madelineproto/src/MTProtoSession/CallHandler.php(98): danog\MadelineProto\Connection->methodCallAsyncWrite()

4 /var/www/html/files/vendor/danog/madelineproto/src/MTProtoTools/CallHandler.php(45): danog\MadelineProto\Connection->methodCallAsyncRead()

5 /var/www/html/files/vendor/danog/madelineproto/src/Namespace/AbstractAPI.php(70): danog\MadelineProto\MTProto->methodCallAsyncRead()

6 /var/www/html/files/f2l_bot.php(70): danog\MadelineProto\Namespace\AbstractAPI->__call()

7 /var/www/html/files/vendor/danog/madelineproto/src/EventHandler.php(227): MyEventHandler->handleMessage()

8 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(425): danog\MadelineProto\EventHandler::danog\MadelineProto{closure}()

9 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(616): Revolt\EventLoop\Internal\AbstractDriver->invokeMicrotasks()

10 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal{closure}()

11 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/DriverSuspension.php(64): Fiber->resume()

12 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(425): Revolt\EventLoop\Internal\DriverSuspension::Revolt\EventLoop\Internal{closure}()

13 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(616): Revolt\EventLoop\Internal\AbstractDriver->invokeMicrotasks()

14 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal{closure}()

15 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(497): Fiber->resume()

16 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(553): Revolt\EventLoop\Internal\AbstractDriver->invokeCallbacks()

17 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal{closure}()

18 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(94): Fiber->resume()

19 /var/www/html/files/vendor/revolt/event-loop/src/EventLoop/Internal/DriverSuspension.php(117): Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal{closure}()

20 /var/www/html/files/vendor/amphp/amp/src/Future.php(251): Revolt\EventLoop\Internal\DriverSuspension->suspend()

21 /var/www/html/files/vendor/danog/madelineproto/src/Wrappers/Loop.php(107): Amp\Future->await()

22 /var/www/html/files/vendor/danog/madelineproto/src/AbstractAPI.php(84): danog\MadelineProto\MTProto->loop()

23 /var/www/html/files/vendor/danog/madelineproto/src/AbstractAPI.php(65): danog\MadelineProto\AbstractAPI->startAndLoopLogic()

24 /var/www/html/files/vendor/danog/madelineproto/src/EventHandler.php(100): danog\MadelineProto\AbstractAPI->startAndLoopInternal()

25 /var/www/html/files/f2l_bot.php(315): danog\MadelineProto\EventHandler::startAndLoopBot()

26 {main}

danog commented 9 months ago

What does f2l_bot.php:256 do?

danog commented 9 months ago

And f2l_bot.php:70

MrParAziT commented 9 months ago

70: $this->messages->sendMessage 256: $this->messages->sendMessage

danog commented 9 months ago

And what parameters are being passed?

danog commented 9 months ago

Make sure you're using the SimpleEventHandler pls

MrParAziT commented 9 months ago

Make sure you're using the SimpleEventHandler pls

I'm sure. class MyEventHandler extends SimpleEventHandler { ....

MrParAziT commented 9 months ago

And what parameters are being passed?

peer, message

danog commented 9 months ago

And how are you obtaining the peer? You should be using $message->chatId with simple filters (NOT onUpdateNew... handlers)

danog commented 9 months ago

Basically you're 100% just passing an invalid ID, try logging the exact ID you're passing before the exception

MrParAziT commented 9 months ago

And how are you obtaining the peer? You should be using $message->chatId with simple filters (NOT onUpdateNew... handlers)

Ummm... I'm using id from database, now what can i do?Is it related to this?

danog commented 9 months ago

The problem is that the ID is 100% incorrect, either an invalid string, or something else. Log the ID you're passing to the method when the exception is thrown to debug the issue.

MrParAziT commented 9 months ago

The problem is that the ID is 100% incorrect, either an invalid string, or something else. Log the ID you're passing to the method when the exception is thrown to debug the issue.

The problem is that the ID is 100% incorrect, either an invalid string, or something else. Log the ID you're passing to the method when the exception is thrown to debug the issue.

Ok I will tell you the result, thank you...

MrParAziT commented 9 months ago

Nice, The problem was solved.