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

error in JSONRPC's get_message() #5370

Closed
adbenitez opened this issue Mar 22, 2024 · 4 comments
Closed

error in JSONRPC's get_message() #5370

adbenitez opened this issue Mar 22, 2024 · 4 comments
Assignees
Labels
bug Something is not working jsonrpc

Comments

@adbenitez
Copy link
Member

My bots are sometimes getting an internal JSONRPC error when using API call get_message() it seems related to the "new" info messages shown when some peer changed keys and chat protection is broken, for some reason loading such messages with get_message() results in an exception when get_message() internally tries to load the sender contact (this special messages have no real sender) at least this is my assumption of the cause of the error

  • Logs:
ERROR    {'code': -1, 'message': 'failed to load sender contact\n\nCaused by:\n    contact Contact#Undefined not    
         found'}                                                                                                    
         Traceback (most recent call last):                                                                         
           File "/home/adbenitez/projects/deltachat-bot/python/deltabot-cli-py/deltabot_cli/cli.py", line 265, in   
         _serve_cmd                                                                                                 
             bot.run_forever(accounts[0] if args.account else 0)                                                    
           File "/home/adbenitez/projects/deltachat-bot/python/deltabot-cli-py/deltabot_cli/client.py", line 67, in 
         run_forever                                                                                                
             self.run_until(lambda _: False, accid)                                                                 
           File "/home/adbenitez/projects/deltachat-bot/python/deltabot-cli-py/deltabot_cli/client.py", line 93, in 
         run_until                                                                                                  
             self._process_messages(accid)                                                                          
           File "/home/adbenitez/projects/deltachat-bot/python/deltabot-cli-py/deltabot_cli/client.py", line 170, in
         _process_messages                                                                                          
             msg = self.rpc.get_message(accid, msgid)                                                               
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                               
           File "/home/adbenitez/projects/deltachat-bot/python/deltabot-cli-py/deltabot_cli/rpc.py", line 140, in   
         method                                                                                                     
             raise JsonRpcError(response["error"])                                                                  
         deltabot_cli.rpc.JsonRpcError: {'code': -1, 'message': 'failed to load sender contact\n\nCaused by:\n      
         contact Contact#Undefined not found'}
@adbenitez adbenitez added bug Something is not working jsonrpc labels Mar 22, 2024
@link2xt link2xt self-assigned this Mar 23, 2024
@link2xt
Copy link
Collaborator

link2xt commented Mar 23, 2024

this special messages have no real sender

Info messages have DC_CONTACT_ID_INFO (2) sender, not undefined (0) sender. Could you load corresponding message from msgs table and see what message it is? I made a PR to log msg_id in the error: #5372 But printing msgid in Python should also be possible.

This looks more like an attempt to load trashed message, info messages should be loadable without problems and desktop does it all the time.

@adbenitez
Copy link
Member Author

This looks more like an attempt to load trashed message, info messages should be loadable without problems and desktop does it all the time.

This might be it, I started using more often "delete_device_after" in my bots to not keep private data that is not necessary, it might be that the messages are trashed by the time the bot already fetched the "next messages" IDs in some situations like bot start/resume

@link2xt
Copy link
Collaborator

link2xt commented Apr 11, 2024

@adbenitez Could you check with the updated core that logs msg_id which message it is?

@link2xt
Copy link
Collaborator

link2xt commented May 15, 2024

With #5464 it is not possible to load trashed messages anymore.

@link2xt link2xt closed this as completed May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working jsonrpc
Projects
None yet
Development

No branches or pull requests

2 participants