There are still problems after correcting the error in "doc_metadat". #8909

Closed
opened 2026-02-21 18:28:32 -05:00 by yindo · 7 comments
Owner

Originally created by @blacktea1891 on GitHub (Mar 3, 2025).

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

1.0.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

The bug has been mentioned in issues #14569 and #14590 As suggested in the issues, I've corrected the spelling error of "doc_metadat" in dataset_retriever_tool.py. However, when retrieving data from the knowledge base, I still encounter the same error.

Image

Image

✔️ Expected Behavior

Successfully retrieved information from the knowledge base and returned it.What should I do to avoid this error?

Actual Behavior

The retrieval error still occurs.

Originally created by @blacktea1891 on GitHub (Mar 3, 2025). ### 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 1.0.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce The bug has been mentioned in issues #14569 and #14590 As suggested in the issues, I've corrected the spelling error of "doc_metadat" in dataset_retriever_tool.py. However, when retrieving data from the knowledge base, I still encounter the same error. ![Image](https://github.com/user-attachments/assets/4dc3f330-568d-4b1b-9973-ba22ea224ed9) ![Image](https://github.com/user-attachments/assets/d1ecacf0-4fdd-4bbf-b677-e8ac824d20b6) ### ✔️ Expected Behavior Successfully retrieved information from the knowledge base and returned it.What should I do to avoid this error? ### ❌ Actual Behavior The retrieval error still occurs.
yindo added the 🐞 bug label 2026-02-21 18:28:32 -05:00
yindo closed this issue 2026-02-21 18:28:32 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 3, 2025):

Hello @blacktea1891! I'm here to help you with any bugs, questions, or contributions you might have regarding Dify. Let's work on resolving the issue you've encountered.

The error you're encountering seems to persist even after correcting the spelling of "doc_metadat" to "doc_metadata" in the dataset_retriever_tool.py file. Here are a few steps you can take to further troubleshoot and resolve the issue:

  1. Verify Attribute Existence: Ensure that the Document object being referenced actually has a doc_metadata attribute. This attribute should be correctly initialized and populated as per the expected schema for the document type [1].

  2. Check Initialization and Population: Review how the doc_metadata is initialized and populated in your code. It should be initialized as an empty dictionary if not provided and populated based on the document details [1].

  3. Review Related Code: Double-check other parts of the codebase where doc_metadata is referenced or manipulated. Ensure that all references are consistent and correctly spelled.

  4. Type Checking: The # type: ignore comment suggests there might be a type-checking issue. Ensure that the type of doc_metadata is consistent with what is expected in the codebase.

  5. Logs and Debugging: Add logging or debugging statements to trace the flow of data and confirm that doc_metadata is being correctly set and accessed at runtime.

  6. Unit Tests: If there are any unit tests related to doc_metadata, review them to ensure they cover the scenarios you're encountering. If not, consider writing tests to validate the behavior.

By following these steps, you should be able to identify the root cause of the error and implement a solution.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Mar 3, 2025): <!-- Greeting --> Hello @blacktea1891! I'm here to help you with any bugs, questions, or contributions you might have regarding Dify. Let's work on resolving the issue you've encountered. <!-- Answer --> The error you're encountering seems to persist even after correcting the spelling of "doc_metadat" to "doc_metadata" in the `dataset_retriever_tool.py` file. Here are a few steps you can take to further troubleshoot and resolve the issue: 1. **Verify Attribute Existence**: Ensure that the `Document` object being referenced actually has a `doc_metadata` attribute. This attribute should be correctly initialized and populated as per the expected schema for the document type <sup>[[1]](https://github.com/langgenius/dify/blob/main/web/app/components/datasets/documents/detail/metadata/index.tsx)</sup>. 2. **Check Initialization and Population**: Review how the `doc_metadata` is initialized and populated in your code. It should be initialized as an empty dictionary if not provided and populated based on the document details <sup>[[1]](https://github.com/langgenius/dify/blob/main/web/app/components/datasets/documents/detail/metadata/index.tsx)</sup>. 3. **Review Related Code**: Double-check other parts of the codebase where `doc_metadata` is referenced or manipulated. Ensure that all references are consistent and correctly spelled. 4. **Type Checking**: The `# type: ignore` comment suggests there might be a type-checking issue. Ensure that the type of `doc_metadata` is consistent with what is expected in the codebase. 5. **Logs and Debugging**: Add logging or debugging statements to trace the flow of data and confirm that `doc_metadata` is being correctly set and accessed at runtime. 6. **Unit Tests**: If there are any unit tests related to `doc_metadata`, review them to ensure they cover the scenarios you're encountering. If not, consider writing tests to validate the behavior. By following these steps, you should be able to identify the root cause of the error and implement a solution. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/d592b332-188a-426f-816b-ee57b74d5c3a?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/d592b332-188a-426f-816b-ee57b74d5c3a?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/d592b332-188a-426f-816b-ee57b74d5c3a?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/d592b332-188a-426f-816b-ee57b74d5c3a?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/d592b332-188a-426f-816b-ee57b74d5c3a?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/d592b332-188a-426f-816b-ee57b74d5c3a?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/d592b332-188a-426f-816b-ee57b74d5c3a?feedback_type=other)</sup>
Author
Owner

@blacktea1891 commented on GitHub (Mar 3, 2025):

In the recall test, there are paragraphs that are recalled.

Image

@blacktea1891 commented on GitHub (Mar 3, 2025): In the recall test, there are paragraphs that are recalled. ![Image](https://github.com/user-attachments/assets/b913e74a-bbe0-4748-9af0-fe7f981c715d)
Author
Owner

@crazywoola commented on GitHub (Mar 3, 2025):

fix: typo doc_metadat (#14569)

@crazywoola commented on GitHub (Mar 3, 2025): fix: typo `doc_metadat` (#14569)
Author
Owner

@blacktea1891 commented on GitHub (Mar 3, 2025):

@crazywoola I've corrected the spelling error, but it still doesn't work. How can I make it work?

@blacktea1891 commented on GitHub (Mar 3, 2025): @crazywoola I've corrected the spelling error, but it still doesn't work. How can I make it work?
Author
Owner

@layoonmietly commented on GitHub (Mar 3, 2025):

I also encountered the same problem. I deployed Docker Compose and it appeared after updating to version 1.0.0 in the Docker directory. I have checked and confirmed that the local source code is the code fixed by # 14569. I also used Docker Compose Down and Docker Compose Up-d to restart the service, but still have this problem. I suspect that it may be due to a problem with the image pulled by Docker Compose Up-d @crazywoola

@layoonmietly commented on GitHub (Mar 3, 2025): I also encountered the same problem. I deployed Docker Compose and it appeared after updating to version 1.0.0 in the Docker directory. I have checked and confirmed that the local source code is the code fixed by # 14569. I also used Docker Compose Down and Docker Compose Up-d to restart the service, but still have this problem. I suspect that it may be due to a problem with the image pulled by Docker Compose Up-d @crazywoola
Author
Owner

@gesila1997 commented on GitHub (Mar 4, 2025):

I also encountered the same problem.@crazywoola

@gesila1997 commented on GitHub (Mar 4, 2025): I also encountered the same problem.@crazywoola
Author
Owner

@silinsi commented on GitHub (Mar 16, 2025):

It seems that you just fixed the code outside the docker container, but code file in docker not upgraded, you can use "docker cp dataset_retriever_tool.py dify-api-1:/app/api/core/tools/utils/dataset_retriever/" and "docker restart dify-api-1" to make the fix work

@silinsi commented on GitHub (Mar 16, 2025): It seems that you just fixed the code outside the docker container, but code file in docker not upgraded, you can use "docker cp dataset_retriever_tool.py dify-api-1:/app/api/core/tools/utils/dataset_retriever/" and "docker restart dify-api-1" to make the fix work
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8909