ehForwarderBot / efb-wechat-slave

A channel for EH Forwarder Bot.
GNU Affero General Public License v3.0
459 stars 62 forks source link

Error when getting chat by ID: `more than one found ` #110

Open blueset opened 3 years ago

blueset commented 3 years ago

Reported by Blueness Wen at https://t.me/c/1083959736/75977.

Message I/O works, but ETM command /update_info (which triggers get_chat()) fails due to more than one found error reported by wxpy.

Initial guess: hashmap collision?

Log:

Chat linked (blueset.wechat) is not found in the slave channel (7aab41b2).
Traceback (most recent call last):
    File "/usr/lib/python3.8/site-packages/efb_wechat_slave/chats.py", line 162, in search_chat
        chat = wxpy.utils.ensure_one(self.bot.search(puid=uid))
    File "/usr/lib/python3.8/site-packages/efb_wechat_slave/vendor/wxpy/utils/tools.py", line 42, in ensure_one
        raise ValueError('more than one found')
ValueError: more than one found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
    File "/usr/lib/python3.8/site-packages/efb_wechat_slave/chats.py", line 162, in search_chat
        chat = wxpy.utils.ensure_one(self.bot.search(puid=uid))
    File "/usr/lib/python3.8/site-packages/efb_wechat_slave/vendor/wxpy/utils/tools.py", line 42, in ensure_one
        raise ValueError('more than one found')
ValueError: more than one found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
    File "/usr/lib/python3.8/site-packages/efb_telegram_master/chat_binding.py", line 837, in update_group_info
        chat = self.chat_manager.update_chat_obj(channel.get_chat(chat_uid), full_update=True)
    File "/usr/lib/python3.8/site-packages/efb_wechat_slave/__init__.py", line 704, in get_chat
        chat = self.chats.search_chat(uid=chat_uid)
    File "/usr/lib/python3.8/site-packages/efb_wechat_slave/chats.py", line 166, in search_chat
        return self.search_chat(uid, refresh=True)
    File "/usr/lib/python3.8/site-packages/efb_wechat_slave/chats.py", line 168, in search_chat
        raise EFBChatNotFound()
ehforwarderbot.exceptions.EFBChatNotFound
luyangliu1 commented 2 years ago

遇到了相同bug

版本信息 Version Info

efb-wechat-slave-2.0.5

问题描述 Describe the bug

不同好友具有相同默认微信名称,备注不同,但是hash相同,导致一系列问题诸如在telegram绑定群组失败。

重现步骤 To Reproduce

telegram绑定失败,提示未在从端「WeChat Slave」(blueset.wechat)中找到绑定的会话(***)。

查看 /0_get_chat_list -r 输出结果发现两位好友具有相同hash

Verbose 日志 Log

Verbose 日志 ``` 请在下方贴出您的 Verbose 日志。如果您对隐私有所顾虑,您可以自行 隐去隐私信息、或 GPG 加密至 BD6B65EC00638DC9083781D5D4B65BB1A106200A。 【贴在下面】 2022-01-11 07:26:31,646 [ERROR]: efb_telegram_master.chat_binding (chat_binding.update_group_info; chat_binding.py:937) Chat linked (blueset.wechat) is not found in the slave channel (*****). Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/efb_wechat_slave/chats.py", line 162, in search_chat chat = wxpy.utils.ensure_one(self.bot.search(puid=uid)) File "/usr/local/lib/python3.7/dist-packages/efb_wechat_slave/vendor/wxpy/utils/tools.py", line 42, in ensure_one raise ValueError('more than one found') ValueError: more than one found 【贴在上面】 ```

备注 Additional context