Error retreiving knowledge #6246

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

Originally created by @damadorPL on GitHub (Oct 22, 2024).

Originally assigned to: @laipz8200, @JohnJyong on GitHub.

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.10.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

crwal any url with firefrawl/jina

text-embedding-ada-002
jina-reranker-v2-base-multilingual

but it fail with any combination

add it to completition and test

api return

2024-10-22 18:53:48,170.170 ERROR [Thread-3 (_generate_worker)] [app_generator.py:210] - Unknown Error when generating
Traceback (most recent call last):
  File "/app/api/core/app/apps/completion/app_generator.py", line 191, in _generate_worker
    runner.run(
  File "/app/api/core/app/apps/completion/app_runner.py", line 119, in run
    context = dataset_retrieval.retrieve(
  File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 122, in retrieve
    all_documents = self.single_retrieve(
  File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 330, in single_retrieve
    results = RetrievalService.retrieve(
  File "/app/api/core/rag/datasource/retrieval_service.py", line 104, in retrieve
    raise Exception(exception_message)
Exception: 'NoneType' object has no attribute 'replace';
'NoneType' object has no attribute 'replace'
2024-10-22 18:53:48,180.180 ERROR [Dummy-2] [base_app_generate_response_converter.py:131] - 'NoneType' object has no attribute 'replace';
'NoneType' object has no attribute 'replace'

✔️ Expected Behavior

working generation

Actual Behavior

no generation and error in api

Originally created by @damadorPL on GitHub (Oct 22, 2024). Originally assigned to: @laipz8200, @JohnJyong on GitHub. ### 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.10.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce crwal any url with firefrawl/jina text-embedding-ada-002 jina-reranker-v2-base-multilingual but it fail with any combination add it to completition and test api return ``` 2024-10-22 18:53:48,170.170 ERROR [Thread-3 (_generate_worker)] [app_generator.py:210] - Unknown Error when generating Traceback (most recent call last): File "/app/api/core/app/apps/completion/app_generator.py", line 191, in _generate_worker runner.run( File "/app/api/core/app/apps/completion/app_runner.py", line 119, in run context = dataset_retrieval.retrieve( File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 122, in retrieve all_documents = self.single_retrieve( File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 330, in single_retrieve results = RetrievalService.retrieve( File "/app/api/core/rag/datasource/retrieval_service.py", line 104, in retrieve raise Exception(exception_message) Exception: 'NoneType' object has no attribute 'replace'; 'NoneType' object has no attribute 'replace' 2024-10-22 18:53:48,180.180 ERROR [Dummy-2] [base_app_generate_response_converter.py:131] - 'NoneType' object has no attribute 'replace'; 'NoneType' object has no attribute 'replace' ``` ### ✔️ Expected Behavior working generation ### ❌ Actual Behavior no generation and error in api
yindo added the 🐞 bug label 2026-02-21 18:14:42 -05:00
yindo closed this issue 2026-02-21 18:14:42 -05:00
Author
Owner

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

I found some similar issues that might be relevant to the error you're encountering:

  1. ERROR: '<' not supported between instances of 'NoneType' and 'NoneType' - This issue was resolved by upgrading to version 0.10.0, which you are already using.

  2. Failed to invoke tool: 'NoneType' object has no attribute 'items' - The suggested solutions for this issue include:

    • Ensuring that tool parameters are correctly formatted as a dictionary and that the timezone provided is valid.
    • Verifying and updating environment variables and configurations in your Docker setup, then restarting your Docker containers.
    • Considering using a different or smarter model, as switching to a higher quality model resolved the issue for another user.

The error message you're seeing suggests that there might be a None value where a string is expected, specifically related to the replace method. Ensure that all required parameters are provided and correctly formatted. If the issue persists, you might want to check the implementation of the retrieve method in the retrieval_service.py file to ensure that the inputs to this method are valid and correctly formatted [1].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 22, 2024): <!-- Answer --> I found some similar issues that might be relevant to the error you're encountering: 1. [ERROR: '<' not supported between instances of 'NoneType' and 'NoneType'](https://github.com/langgenius/dify/issues/9638) - This issue was resolved by upgrading to version 0.10.0, which you are already using. 2. [Failed to invoke tool: 'NoneType' object has no attribute 'items'](https://github.com/langgenius/dify/issues/8333) - The suggested solutions for this issue include: - Ensuring that tool parameters are correctly formatted as a dictionary and that the timezone provided is valid. - Verifying and updating environment variables and configurations in your Docker setup, then restarting your Docker containers. - Considering using a different or smarter model, as switching to a higher quality model resolved the issue for another user. The error message you're seeing suggests that there might be a `None` value where a string is expected, specifically related to the `replace` method. Ensure that all required parameters are provided and correctly formatted. If the issue persists, you might want to check the implementation of the `retrieve` method in the `retrieval_service.py` file to ensure that the inputs to this method are valid and correctly formatted <sup>[[1]](https://github.com/langgenius/dify/issues/8333)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@JohnJyong commented on GitHub (Oct 23, 2024):

hi @damadorPL , I can't reproduce your problem here. Can you provide more screenshots of the operation? Or can you try it in our SaaS environment dify.ai and see if it can be reproduced? thanks

@JohnJyong commented on GitHub (Oct 23, 2024): hi @damadorPL , I can't reproduce your problem here. Can you provide more screenshots of the operation? Or can you try it in our SaaS environment [ dify.ai](url) and see if it can be reproduced? thanks
Author
Owner

@damadorPL commented on GitHub (Oct 23, 2024):

hi @damadorPL , I can't reproduce your problem here. Can you provide more screenshots of the operation? Or can you try it in our SaaS environment dify.ai and see if it can be reproduced? thanks

https://vimeo.com/1022448757/0e95fb6b45?ts=0&share=copy here is video showing the bug on cloud and way to reproduce it

@damadorPL commented on GitHub (Oct 23, 2024): > hi @damadorPL , I can't reproduce your problem here. Can you provide more screenshots of the operation? Or can you try it in our SaaS environment [ dify.ai](url) and see if it can be reproduced? thanks https://vimeo.com/1022448757/0e95fb6b45?ts=0&share=copy here is video showing the bug on cloud and way to reproduce it
Author
Owner

@damadorPL commented on GitHub (Oct 23, 2024):

problem persist on 10.1

2024-10-23T11:28:01.655817231Z 2024-10-23 11:28:01,652.652 ERROR [Thread-4 (_generate_worker)] [app_generator.py:210] - Unknown Error when generating
2024-10-23T11:28:01.655876251Z Traceback (most recent call last):
2024-10-23T11:28:01.655883965Z File "/app/api/core/app/apps/completion/app_generator.py", line 191, in _generate_worker
2024-10-23T11:28:01.655888544Z runner.run(
2024-10-23T11:28:01.655892531Z File "/app/api/core/app/apps/completion/app_runner.py", line 119, in run
2024-10-23T11:28:01.655896729Z context = dataset_retrieval.retrieve(
2024-10-23T11:28:01.655900727Z File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 122, in retrieve
2024-10-23T11:28:01.655904875Z all_documents = self.single_retrieve(
2024-10-23T11:28:01.655908912Z File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 330, in single_retrieve
2024-10-23T11:28:01.655913020Z results = RetrievalService.retrieve(
2024-10-23T11:28:01.655917027Z File "/app/api/core/rag/datasource/retrieval_service.py", line 104, in retrieve
2024-10-23T11:28:01.655921145Z raise Exception(exception_message)
2024-10-23T11:28:01.655925122Z Exception: 'NoneType' object has no attribute 'replace';
2024-10-23T11:28:01.655929149Z 'NoneType' object has no attribute 'replace'
2024-10-23T11:28:01.661720244Z 2024-10-23 11:28:01,661.661 ERROR [Dummy-5] [base_app_generate_response_converter.py:131] - 'NoneType' object has no attribute 'replace';
2024-10-23T11:28:01.661751621Z 'NoneType' object has no attribute 'replace'

@damadorPL commented on GitHub (Oct 23, 2024): problem persist on 10.1 2024-10-23T11:28:01.655817231Z 2024-10-23 11:28:01,652.652 ERROR [Thread-4 (_generate_worker)] [app_generator.py:210] - Unknown Error when generating 2024-10-23T11:28:01.655876251Z Traceback (most recent call last): 2024-10-23T11:28:01.655883965Z File "/app/api/core/app/apps/completion/app_generator.py", line 191, in _generate_worker 2024-10-23T11:28:01.655888544Z runner.run( 2024-10-23T11:28:01.655892531Z File "/app/api/core/app/apps/completion/app_runner.py", line 119, in run 2024-10-23T11:28:01.655896729Z context = dataset_retrieval.retrieve( 2024-10-23T11:28:01.655900727Z File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 122, in retrieve 2024-10-23T11:28:01.655904875Z all_documents = self.single_retrieve( 2024-10-23T11:28:01.655908912Z File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 330, in single_retrieve 2024-10-23T11:28:01.655913020Z results = RetrievalService.retrieve( 2024-10-23T11:28:01.655917027Z File "/app/api/core/rag/datasource/retrieval_service.py", line 104, in retrieve 2024-10-23T11:28:01.655921145Z raise Exception(exception_message) 2024-10-23T11:28:01.655925122Z Exception: 'NoneType' object has no attribute 'replace'; 2024-10-23T11:28:01.655929149Z 'NoneType' object has no attribute 'replace' 2024-10-23T11:28:01.661720244Z 2024-10-23 11:28:01,661.661 ERROR [Dummy-5] [base_app_generate_response_converter.py:131] - 'NoneType' object has no attribute 'replace'; 2024-10-23T11:28:01.661751621Z 'NoneType' object has no attribute 'replace'
Author
Owner

@damadorPL commented on GitHub (Oct 28, 2024):

still bugged in v0.10.2

2024-10-28T11:16:15.448039942Z 2024-10-28 11:16:15,443.443 ERROR [Thread-3 (_generate_worker)] [app_generator.py:210] - Unknown Error when generating
2024-10-28T11:16:15.448149977Z Traceback (most recent call last):
2024-10-28T11:16:15.448155487Z File "/app/api/core/app/apps/completion/app_generator.py", line 191, in _generate_worker
2024-10-28T11:16:15.448160297Z runner.run(
2024-10-28T11:16:15.448164655Z File "/app/api/core/app/apps/completion/app_runner.py", line 119, in run
2024-10-28T11:16:15.448168993Z context = dataset_retrieval.retrieve(
2024-10-28T11:16:15.448173171Z File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 122, in retrieve
2024-10-28T11:16:15.448177758Z all_documents = self.single_retrieve(
2024-10-28T11:16:15.448182136Z File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 330, in single_retrieve
2024-10-28T11:16:15.448186404Z results = RetrievalService.retrieve(
2024-10-28T11:16:15.448190532Z File "/app/api/core/rag/datasource/retrieval_service.py", line 104, in retrieve
2024-10-28T11:16:15.448194850Z raise Exception(exception_message)
2024-10-28T11:16:15.448199008Z Exception: 'NoneType' object has no attribute 'replace';
2024-10-28T11:16:15.448203166Z 'NoneType' object has no attribute 'replace'
2024-10-28T11:16:15.459258785Z 2024-10-28 11:16:15,458.458 ERROR [Dummy-2] [base_app_generate_response_converter.py:131] - 'NoneType' object has no attribute 'replace';
2024-10-28T11:16:15.459303248Z 'NoneType' object has no attribute 'replace'

@damadorPL commented on GitHub (Oct 28, 2024): still bugged in v0.10.2 2024-10-28T11:16:15.448039942Z 2024-10-28 11:16:15,443.443 ERROR [Thread-3 (_generate_worker)] [app_generator.py:210] - Unknown Error when generating 2024-10-28T11:16:15.448149977Z Traceback (most recent call last): 2024-10-28T11:16:15.448155487Z File "/app/api/core/app/apps/completion/app_generator.py", line 191, in _generate_worker 2024-10-28T11:16:15.448160297Z runner.run( 2024-10-28T11:16:15.448164655Z File "/app/api/core/app/apps/completion/app_runner.py", line 119, in run 2024-10-28T11:16:15.448168993Z context = dataset_retrieval.retrieve( 2024-10-28T11:16:15.448173171Z File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 122, in retrieve 2024-10-28T11:16:15.448177758Z all_documents = self.single_retrieve( 2024-10-28T11:16:15.448182136Z File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 330, in single_retrieve 2024-10-28T11:16:15.448186404Z results = RetrievalService.retrieve( 2024-10-28T11:16:15.448190532Z File "/app/api/core/rag/datasource/retrieval_service.py", line 104, in retrieve 2024-10-28T11:16:15.448194850Z raise Exception(exception_message) 2024-10-28T11:16:15.448199008Z Exception: 'NoneType' object has no attribute 'replace'; 2024-10-28T11:16:15.448203166Z 'NoneType' object has no attribute 'replace' 2024-10-28T11:16:15.459258785Z 2024-10-28 11:16:15,458.458 ERROR [Dummy-2] [base_app_generate_response_converter.py:131] - 'NoneType' object has no attribute 'replace'; 2024-10-28T11:16:15.459303248Z 'NoneType' object has no attribute 'replace'
Author
Owner

@JohnJyong commented on GitHub (Oct 29, 2024):

@damadorPL I'm sorry for replying to you so late. Unfortunately, I can't reproduce your problem according to the steps in your video. Are you free to conduct a test with me through video conference? thanks in advance~

@JohnJyong commented on GitHub (Oct 29, 2024): @damadorPL I'm sorry for replying to you so late. Unfortunately, I can't reproduce your problem according to the steps in your video. Are you free to conduct a test with me through video conference? thanks in advance~
Author
Owner

@damadorPL commented on GitHub (Oct 29, 2024):

https://vimeo.com/1024250659/7349e3a956?share=copy
create app from template set
Fully SEO Optimized Article including FAQs - when you retreive context from knowledge database error is thrown

@damadorPL commented on GitHub (Oct 29, 2024): https://vimeo.com/1024250659/7349e3a956?share=copy create app from template set Fully SEO Optimized Article including FAQs - when you retreive context from knowledge database error is thrown
Author
Owner

@damadorPL commented on GitHub (Oct 29, 2024):

all_documents = self.single_retrieve it seems that app throw error when it receive no data from RAG (NoneType) and it cant replace {{context}} variable

@damadorPL commented on GitHub (Oct 29, 2024): all_documents = self.single_retrieve it seems that app throw error when it receive no data from RAG (NoneType) and it cant replace {{context}} variable
Author
Owner

@damadorPL commented on GitHub (Oct 29, 2024):

The value passed to the retrieval function may be None. This could be due to missing data or some earlier operation not returning the expected result.

@damadorPL commented on GitHub (Oct 29, 2024): The value passed to the retrieval function may be None. This could be due to missing data or some earlier operation not returning the expected result.
Author
Owner

@damadorPL commented on GitHub (Oct 29, 2024):

and copilot says the same

The error message indicates that somewhere in the code, a NoneType object is being accessed with the replace method, which is causing an exception.

Potential NoneType Variables: Check all variables that could potentially be None and are used with the replace method.

Check for None before calling replace.

when passing empty knowledge even if variable is OPTIONAL it hang as null object cant be replaced by replace()

@damadorPL commented on GitHub (Oct 29, 2024): and copilot says the same The error message indicates that somewhere in the code, a NoneType object is being accessed with the replace method, which is causing an exception. Potential NoneType Variables: Check all variables that could potentially be None and are used with the replace method. Check for None before calling replace. --- when passing empty knowledge even if variable is OPTIONAL it hang as null object cant be replaced by replace()
Author
Owner

@JohnJyong commented on GitHub (Oct 31, 2024):

got it, thanks for you feedback, we will fix it soon~

@JohnJyong commented on GitHub (Oct 31, 2024): got it, thanks for you feedback, we will fix it soon~
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6246