Bug: Web app /messages returns `retriever_resources Input should be a valid list` when a message has no retriever_resources
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 86/100
Research direction
Start in api/models/model.py at the retriever_resources property, then inspect api/fields/message_fields.py and controllers/web/message.py to trace the GET /messages response. Ensure messages without a retriever_resources key produce an empty list rather than None, and verify the embedded web history loads for a flow without a Knowledge Retrieval node.
Written by the indexing model from the issue text.
Description
Self Checks
- I have read the Contributing Guide and Language Policy.
- 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, otherwise it will be closed.
- 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- Please do not modify this template :) and fill in all the required fields.
Dify version
1.17.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
- Create a Chatflow / Agent app that does not use a Knowledge Retrieval node. For example, a flow with an SQL query node (or HTTP request node, or Agent node with tool calling).
- Publish the app and embed it into an external page using the "Embed" snippet (the web app, not the service API).
- Send a message so that the conversation history contains at least one message without any
retriever_resources. - Reload the embedded page so it loads the message history via
GET /messages.
✔️ Expected Behavior
Message history loads normally, with retriever_resources as an empty list ([]) for messages that had no retrieval.
❌ Actual Behavior
The embedded page throws:
1 validation error for WebMessageListItem
retriever_resources
Input should be a valid list
[type=list_type, input_value=None, input_type=NoneType]
And the history fails to render.
Root cause
api/models/model.py (around line 1823):
@property
def retriever_resources(self) -> Any:
return self.message_metadata_dict.get("retriever_resources") if self.message_metadata else []
When message_metadata exists but does not contain the retriever_resources key, .get("retriever_resources") returns None instead of []. This None then reaches the required field WebMessageListItem.retriever_resources: list[RetrieverResource] in api/fields/message_fields.py and fails Pydantic validation.
Note: the service_api path (controllers/service_api/app/message.py) was already fixed in PR #17304 (issue #14650), but the web path (controllers/web/message.py → WebMessageListItem) still uses the un-guarded property above.
Suggested fix
Give the .get() a default value so a missing key resolves to an empty list:
return self.message_metadata_dict.get("retriever_resources", []) if self.message_metadata else []
I have verified this one-line change fixes the issue on a self-hosted 1.17.0 Docker deployment.
- Dominant language
- TypeScript
- Stars
- 157k
- Forks
- 24.7k
- Avg merge
- 22h 32m
- Merged PRs (30d)
- 611
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from langgenius/dify
-
Annotation Reply: a stored score threshold of 0.0 is silently replaced with 1, disabling the feature Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
langgenius/dify#42639 · 1 comment · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
langgenius/dify#42468 · 1 comment · 1 reaction ·
-
🐞 bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
langgenius/dify#42446 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
langgenius/dify#42355 · 1 comment · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
langgenius/dify#42350 · 1 comment · 1 reaction ·
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100