Retriever resources missing from conversation history when fetching with GET /messages endpoint #7668

Closed
opened 2026-02-21 18:21:44 -05:00 by yindo · 4 comments
Owner

Originally created by @oujichin on GitHub (Jan 11, 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

0.15.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Create a conversation using either:

    • Chat API endpoint
    • Dify Web UI: Navigate to Publish > Run App and use the chat interface
  2. Send messages in a conversation that uses Chatflow feature (other features not tested)

  3. Confirm that the initial chat responses include retriever_resources

  4. Try to get conversation history using either:

    • GET /messages endpoint:
      curl -X GET "https://dify.xxxxxx.com/v1/messages?user=user-1&conversation_id=YOUR_CONVERSATION_ID" \ --header "Authorization: Bearer YOUR_API_KEY"
    • Or through Dify Web UI: Reload the chat or select the conversation from history

✔️ Expected Behavior

The GET /messages endpoint should return conversation history including retriever_resources for each message, as specified in the API documentation:

{ "limit": 20, "has_more": false, "data": [ { "id": "a076a87f-31e5-48dc-b452-0061adbbc922", "conversation_id": "cd78daf6-f9e4-4463-9ff2-54257230a0ce", "inputs": { "name": "dify" }, "query": "iphone 13 pro", "answer": "The iPhone 13 Pro, released on September 24, 2021, features a 6.1-inch display with a resolution of 1170 x 2532. It is equipped with a Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard) processor, 6 GB of RAM, and offers storage options of 128 GB, 256 GB, 512 GB, and 1 TB. The camera is 12 MP, the battery capacity is 3095 mAh, and it runs on iOS 15.", "message_files": [], "feedback": null, "retriever_resources": [ { "position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\"" } ], "created_at": 1705569239, } ] }

Actual Behavior

The GET /messages endpoint returns conversation history with empty retriever_resources, even though the original chat response included them:
{
"limit": 20,
"has_more": false,
"data": [
{
"id": "a076a87f-31e5-48dc-b452-0061adbbc922",
"conversation_id": "cd78daf6-f9e4-4463-9ff2-54257230a0ce",
"inputs": {
"name": "dify"
},
"query": "iphone 13 pro",
"answer": "The iPhone 13 Pro, released on September 24, 2021, features a 6.1-inch display with a resolution of 1170 x 2532. It is equipped with a Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard) processor, 6 GB of RAM, and offers storage options of 128 GB, 256 GB, 512 GB, and 1 TB. The camera is 12 MP, the battery capacity is 3095 mAh, and it runs on iOS 15.",
"message_files": [],
"feedback": null,
"retriever_resources": [], // Empty array,
"created_at": 1705569239,
}
]
}

Originally created by @oujichin on GitHub (Jan 11, 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 0.15.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1. Create a conversation using either: - Chat API endpoint - Dify Web UI: Navigate to Publish > Run App and use the chat interface 2. Send messages in a conversation that uses Chatflow feature (other features not tested) 3. Confirm that the initial chat responses include retriever_resources 4. Try to get conversation history using either: - GET /messages endpoint: ` curl -X GET "https://dify.xxxxxx.com/v1/messages?user=user-1&conversation_id=YOUR_CONVERSATION_ID" \ --header "Authorization: Bearer YOUR_API_KEY" ` - Or through Dify Web UI: Reload the chat or select the conversation from history ### ✔️ Expected Behavior The GET /messages endpoint should return conversation history including retriever_resources for each message, as specified in the API documentation: `{ "limit": 20, "has_more": false, "data": [ { "id": "a076a87f-31e5-48dc-b452-0061adbbc922", "conversation_id": "cd78daf6-f9e4-4463-9ff2-54257230a0ce", "inputs": { "name": "dify" }, "query": "iphone 13 pro", "answer": "The iPhone 13 Pro, released on September 24, 2021, features a 6.1-inch display with a resolution of 1170 x 2532. It is equipped with a Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard) processor, 6 GB of RAM, and offers storage options of 128 GB, 256 GB, 512 GB, and 1 TB. The camera is 12 MP, the battery capacity is 3095 mAh, and it runs on iOS 15.", "message_files": [], "feedback": null, "retriever_resources": [ { "position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\"" } ], "created_at": 1705569239, } ] } ` ### ❌ Actual Behavior The GET /messages endpoint returns conversation history with empty retriever_resources, even though the original chat response included them: { "limit": 20, "has_more": false, "data": [ { "id": "a076a87f-31e5-48dc-b452-0061adbbc922", "conversation_id": "cd78daf6-f9e4-4463-9ff2-54257230a0ce", "inputs": { "name": "dify" }, "query": "iphone 13 pro", "answer": "The iPhone 13 Pro, released on September 24, 2021, features a 6.1-inch display with a resolution of 1170 x 2532. It is equipped with a Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard) processor, 6 GB of RAM, and offers storage options of 128 GB, 256 GB, 512 GB, and 1 TB. The camera is 12 MP, the battery capacity is 3095 mAh, and it runs on iOS 15.", "message_files": [], "feedback": null, "retriever_resources": [], // Empty array, "created_at": 1705569239, } ] }
yindo added the 🐞 bug label 2026-02-21 18:21:44 -05:00
yindo closed this issue 2026-02-21 18:21:44 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 11, 2025):

Hello @oujichin! I'm here to help you with any bugs, questions, or contributions. Let's work together to solve the issue you've encountered.

I found a similar unsolved discussion titled "Conversation history cannot be retrieved" which was last updated on December 16, 2024 [1].

Regarding the issue you're facing with missing retriever_resources in the GET /messages endpoint response, there are a few things to consider:

  1. Configuration Check: Ensure that the show_retrieve_source feature is enabled in your application's configuration. This feature controls whether retriever_resources are included in the response. If it's not enabled, the retriever_resources will not be included [2].

  2. Error Handling: The _handle_retriever_resources method in the MessageCycleManage class is responsible for handling retriever_resources. If this method does not receive the expected data or if the feature is disabled, the retriever_resources will be empty [2].

  3. Logging and Debugging: There is no explicit logging for missing retriever_resources, so adding logging in the relevant service methods could help diagnose the issue. Check if there are any errors or exceptions being logged that might indicate why the data is missing [3].

These steps should help you identify the cause of the missing retriever_resources in your self-hosted Dify instance.

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Jan 11, 2025): <!-- Greeting --> Hello @oujichin! I'm here to help you with any bugs, questions, or contributions. Let's work together to solve the issue you've encountered. <!-- Answer --> I found a similar unsolved discussion titled "[Conversation history cannot be retrieved](https://github.com/langgenius/dify/discussions/11000)" which was last updated on December 16, 2024 <sup>[[1]](https://github.com/langgenius/dify/discussions/11000)</sup>. Regarding the issue you're facing with missing `retriever_resources` in the `GET /messages` endpoint response, there are a few things to consider: 1. **Configuration Check**: Ensure that the `show_retrieve_source` feature is enabled in your application's configuration. This feature controls whether `retriever_resources` are included in the response. If it's not enabled, the `retriever_resources` will not be included <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/app/task_pipeline/message_cycle_manage.py)</sup>. 2. **Error Handling**: The `_handle_retriever_resources` method in the `MessageCycleManage` class is responsible for handling `retriever_resources`. If this method does not receive the expected data or if the feature is disabled, the `retriever_resources` will be empty <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/app/task_pipeline/message_cycle_manage.py)</sup>. 3. **Logging and Debugging**: There is no explicit logging for missing `retriever_resources`, so adding logging in the relevant service methods could help diagnose the issue. Check if there are any errors or exceptions being logged that might indicate why the data is missing <sup>[[3]](https://github.com/langgenius/dify/blob/main/api/controllers/service_api/app/message.py)</sup>. These steps should help you identify the cause of the missing `retriever_resources` in your self-hosted Dify instance. <!-- 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/bca7ccba-218a-4674-8359-15134b8280aa?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/bca7ccba-218a-4674-8359-15134b8280aa?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/bca7ccba-218a-4674-8359-15134b8280aa?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/bca7ccba-218a-4674-8359-15134b8280aa?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/bca7ccba-218a-4674-8359-15134b8280aa?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/bca7ccba-218a-4674-8359-15134b8280aa?feedback_type=other)</sup>
Author
Owner

@oujichin commented on GitHub (Jan 11, 2025):

Regarding the show_retrieve_source setting:

  1. Where can I find this configuration in Dify? Is this Okay?
    image

Thank you for informing about the similar issue.
I'd like to clarify my specific case:

  • The retriever_resources are working correctly in the initial chat responses
  • The issue only occurs when retrieving conversation history via GET /messages endpoint
  • All other data fields are retrieved correctly; only the retriever_resources array is empty
@oujichin commented on GitHub (Jan 11, 2025): Regarding the `show_retrieve_source` setting: 1. Where can I find this configuration in Dify? Is this Okay? ![image](https://github.com/user-attachments/assets/e9ab89a5-8275-438e-9d62-6f48fd477b6e) Thank you for informing about the similar issue. I'd like to clarify my specific case: - The retriever_resources are working correctly in the initial chat responses - The issue only occurs when retrieving conversation history via GET /messages endpoint - All other data fields are retrieved correctly; only the retriever_resources array is empty
Author
Owner

@dosubot[bot] commented on GitHub (Jan 11, 2025):

The show_retrieve_source configuration in Dify is found in the app_config.additional_features of the application_generate_entity. It is used to determine whether to include retriever_resources in the task state metadata. This configuration is managed by the RetrievalResourceConfigManager class, which checks if the retriever_resource is enabled in the configuration and sets show_retrieve_source accordingly [1][2].

If you are looking for this setting in a web application interface, it might not be directly visible as a toggle option. Instead, it is likely configured in the backend settings or configuration files. You may need to check the configuration files or the backend code to ensure that the retriever_resource is enabled.

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Jan 11, 2025): <!-- Answer --> The `show_retrieve_source` configuration in Dify is found in the `app_config.additional_features` of the `application_generate_entity`. It is used to determine whether to include `retriever_resources` in the task state metadata. This configuration is managed by the `RetrievalResourceConfigManager` class, which checks if the `retriever_resource` is enabled in the configuration and sets `show_retrieve_source` accordingly <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/app/task_pipeline/message_cycle_manage.py)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/app/app_config/features/retrieval_resource/manager.py)</sup>. If you are looking for this setting in a web application interface, it might not be directly visible as a toggle option. Instead, it is likely configured in the backend settings or configuration files. You may need to check the configuration files or the backend code to ensure that the `retriever_resource` is enabled. <!-- 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/1cae9f63-0eb5-47e4-b95a-dd2988a14321?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/1cae9f63-0eb5-47e4-b95a-dd2988a14321?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/1cae9f63-0eb5-47e4-b95a-dd2988a14321?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/1cae9f63-0eb5-47e4-b95a-dd2988a14321?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/1cae9f63-0eb5-47e4-b95a-dd2988a14321?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/1cae9f63-0eb5-47e4-b95a-dd2988a14321?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Jan 12, 2025):

Duplicated

@crazywoola commented on GitHub (Jan 12, 2025): Duplicated
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7668