koishijs / koishi

Cross-platform chatbot framework made with love
https://koishi.chat
MIT License
4.45k stars 242 forks source link

Bug: database-mongo RuntimeError (E11000) #777

Closed dragon-fish closed 1 year ago

dragon-fish commented 2 years ago

Describe the bug

频繁报错 RuntimeError: E11000 duplicate key error

Steps to reproduce

用户发言时随机触发,暂时未找到规律

Expected behavior

阿巴阿巴

Screenshots

日志供参考

2022-08-16 17:53:53 [E] [PROCESS_ERROR] 2022-08-16 74d0df61-0647-4bb2-b06b-075ee98b6837 > 
RuntimeError: E11000 duplicate key error collection: sili_v4.user index: unique:onebot dup key: { onebot: "******" }
    at null.<anonymous> (C:\Chatbot-SILI-v4\node_modules\@minatojs\driver-mongo\src\index.ts:303:17)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Session2.observeUser (C:\Chatbot-SILI-v4\node_modules\@koishijs\core\src\session.ts:210:18)
    at async getTotalWeight (C:\Chatbot-SILI-v4\node_modules\@koishijs\plugin-teach\lib\index.js:161:3)
    at async triggerDialogue (C:\Chatbot-SILI-v4\node_modules\@koishijs\plugin-teach\lib\index.js:247:17) {
  code: 'duplicate-entry'
}

Versions

Additional context

最终决定发个工单防止忘了

shigma commented 2 years ago

如果目前无法提供复现,请检查是否有错误使用 session.observeUser()

dragon-fish commented 2 years ago

未曾使用相关api

shigma commented 1 year ago

这个我记得应该在 dialogue 修过了。