In chat mode, the conversation hits the knowledge base search error #6084

Closed
opened 2026-02-21 18:14:00 -05:00 by yindo · 3 comments
Owner

Originally created by @jlokys on GitHub (Oct 14, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.9.1

Cloud or Self Hosted

Self Hosted (Docker), Self Hosted (Source)

Steps to reproduce

In chat mode, the conversation hits the knowledge base search error, as follows:
Traceback (most recent call last):
  File "E:\wsm\dify\api\core\app\apps\chat\app_generator.py", line 203, in _generate_worker
    runner.run(
  File "E:\wsm\dify\api\core\app\apps\chat\app_runner.py", line 159, in run
    context = dataset_retrieval.retrieve(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\wsm\dify\api\core\rag\retrieval\dataset_retrieval.py", line 235, in retrieve
    retrieval_resource_list = sorted(retrieval_resource_list, key=lambda x: x.get("score"), reverse=True)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'NoneType' and 'NoneType'

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @jlokys on GitHub (Oct 14, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.9.1 ### Cloud or Self Hosted Self Hosted (Docker), Self Hosted (Source) ### Steps to reproduce ``` In chat mode, the conversation hits the knowledge base search error, as follows: Traceback (most recent call last): File "E:\wsm\dify\api\core\app\apps\chat\app_generator.py", line 203, in _generate_worker runner.run( File "E:\wsm\dify\api\core\app\apps\chat\app_runner.py", line 159, in run context = dataset_retrieval.retrieve( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\wsm\dify\api\core\rag\retrieval\dataset_retrieval.py", line 235, in retrieve retrieval_resource_list = sorted(retrieval_resource_list, key=lambda x: x.get("score"), reverse=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: '<' not supported between instances of 'NoneType' and 'NoneType' ``` ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:14:00 -05:00
yindo closed this issue 2026-02-21 18:14:00 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 14, 2024):

A similar issue was reported and has been resolved. The problem was related to handling NoneType values in the retrieval_resource_list during sorting, which caused a TypeError [1].

To address this, ensure that all entries in retrieval_resource_list have valid scores before sorting. You might need to filter out or handle None values explicitly to prevent this error.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 14, 2024): <!-- Answer --> A similar issue was reported and has been resolved. The problem was related to handling `NoneType` values in the `retrieval_resource_list` during sorting, which caused a `TypeError` <sup>[[1]](https://github.com/langgenius/dify/issues/6316)</sup>. To address this, ensure that all entries in `retrieval_resource_list` have valid scores before sorting. You might need to filter out or handle `None` values explicitly to prevent this error. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Oct 14, 2024):

Please upgrade to v0.9.2

@crazywoola commented on GitHub (Oct 14, 2024): Please upgrade to v0.9.2
Author
Owner

@jlokys commented on GitHub (Oct 14, 2024):

OK, thanks

@jlokys commented on GitHub (Oct 14, 2024): OK, thanks
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6084