status code 500:can't get history conversation history messages #12769

Closed
opened 2026-02-21 19:08:57 -05:00 by yindo · 5 comments
Owner

Originally created by @MichaelNie1994 on GitHub (Apr 10, 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.2.0

Cloud or Self Hosted

Cloud

Steps to reproduce

I built a front-end myself to connect to DIFY. I can create conversations, typically ask questions, and get replies. However, after updating to version 1.2.0, the front-end page cannot retrieve the historical conversation content properly, although the conversation list is displayed correctly. I used Postman to test the interface, and it reported an error with the status code 500. At the same time, I checked the background using the "docker log" command and found some error messages.

2025-04-10 16:44:32.237 ERROR [Dummy-38] [app.py:875] - Exception on /v1/messages [GET]
Traceback (most recent call last):
File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 489, in wrapper
resp = resource(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view
return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 604, in dispatch_request
resp = meth(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/api/controllers/service_api/wraps.py", line 104, in decorated_view
return view_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 701, in wrapper
return marshal(resp, self.fields, self.envelope)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 657, in marshal
return OrderedDict([(envelope, OrderedDict(items))]) if envelope else OrderedDict(items)
^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 655, in <genexpr>
else make(v).output(k, data))
^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/fields.py", line 197, in output
return self.format(value)
^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/fields.py", line 183, in format
self.container.output(idx,
File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/fields.py", line 152, in output
return marshal(value, self.nested)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 657, in marshal
return OrderedDict([(envelope, OrderedDict(items))]) if envelope else OrderedDict(items)
^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 655, in <genexpr>
else make(v).output(k, data))
^^^^^^^^^^^^^^
AttributeError: 'function' object has no attribute 'output'

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @MichaelNie1994 on GitHub (Apr 10, 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.2.0 ### Cloud or Self Hosted Cloud ### Steps to reproduce I built a front-end myself to connect to DIFY. I can create conversations, typically ask questions, and get replies. However, after updating to version 1.2.0, the front-end page cannot retrieve the historical conversation content properly, although the conversation list is displayed correctly. I used Postman to test the interface, and it reported an error with the status code 500. At the same time, I checked the background using the "docker log" command and found some error messages. ``` 2025-04-10 16:44:32.237 ERROR [Dummy-38] [app.py:875] - Exception on /v1/messages [GET] Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 489, in wrapper resp = resource(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 604, in dispatch_request resp = meth(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/service_api/wraps.py", line 104, in decorated_view return view_func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 701, in wrapper return marshal(resp, self.fields, self.envelope) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 657, in marshal return OrderedDict([(envelope, OrderedDict(items))]) if envelope else OrderedDict(items) ^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 655, in <genexpr> else make(v).output(k, data)) ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/fields.py", line 197, in output return self.format(value) ^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/fields.py", line 183, in format self.container.output(idx, File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/fields.py", line 152, in output return marshal(value, self.nested) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 657, in marshal return OrderedDict([(envelope, OrderedDict(items))]) if envelope else OrderedDict(items) ^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 655, in <genexpr> else make(v).output(k, data)) ^^^^^^^^^^^^^^ AttributeError: 'function' object has no attribute 'output' ``` ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bugcloud labels 2026-02-21 19:08:57 -05:00
yindo closed this issue 2026-02-21 19:08:57 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 10, 2025):

你好 @MichaelNie1994!我是一个可以帮助你解决bug、回答问题并成为贡献者的机器人。很高兴为你提供支持,直到人类维护者能回复你!

There is a known issue with the /messages API endpoint in Dify version 1.2.0 that results in a status code 500 error when trying to retrieve historical conversation content. This bug has been identified and fixed in the cloud version. As a workaround, you can use the /v1/chat-messages endpoint, which functions correctly during this period [1].

Additionally, there are similar discussions related to this issue:

  1. Add messages in a previous conversation - This discussion is still open and may provide further insights or solutions.
  2. Conversation history cannot be retrieved - This discussion is also open and might be relevant to your issue [2][3].

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 (Apr 10, 2025): <!-- Greeting --> 你好 @MichaelNie1994!我是一个可以帮助你解决bug、回答问题并成为贡献者的机器人。很高兴为你提供支持,直到人类维护者能回复你! <!-- Answer --> There is a known issue with the `/messages` API endpoint in Dify version 1.2.0 that results in a status code 500 error when trying to retrieve historical conversation content. This bug has been identified and fixed in the cloud version. As a workaround, you can use the `/v1/chat-messages` endpoint, which functions correctly during this period <sup>[[1]](https://github.com/langgenius/dify/issues/17712)</sup>. Additionally, there are similar discussions related to this issue: 1. [Add messages in a previous conversation](https://github.com/langgenius/dify/discussions/17802) - This discussion is still open and may provide further insights or solutions. 2. [Conversation history cannot be retrieved](https://github.com/langgenius/dify/discussions/11000) - This discussion is also open and might be relevant to your issue <sup>[[2]](https://github.com/langgenius/dify/discussions/17802)</sup><sup>[[3]](https://github.com/langgenius/dify/discussions/11000)</sup>. <!-- 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/66ef58d1-34be-444d-bbe0-96c94af2e6ba?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/66ef58d1-34be-444d-bbe0-96c94af2e6ba?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/66ef58d1-34be-444d-bbe0-96c94af2e6ba?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/66ef58d1-34be-444d-bbe0-96c94af2e6ba?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/66ef58d1-34be-444d-bbe0-96c94af2e6ba?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/66ef58d1-34be-444d-bbe0-96c94af2e6ba?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/66ef58d1-34be-444d-bbe0-96c94af2e6ba?feedback_type=other)</sup>
Author
Owner

@wangtao commented on GitHub (Apr 10, 2025):

you can temporarily modify the code of file "api/controllers/service_api/app/message.py" in the docker-api container

line: 40

from

"retriever_resources": get_retriever_resources,

to

"retriever_resources": fields.List(fields.String, attribute=lambda x: json.loads(x.message_metadata).get("retriever_resources", []) if x.message_metadata else [], default=[]),

and then restart the container by

docker compose restart api

hope this helps!

@wangtao commented on GitHub (Apr 10, 2025): you can temporarily modify the code of file "api/controllers/service_api/app/message.py" in the docker-api container line: 40 from ` "retriever_resources": get_retriever_resources, ` to ` "retriever_resources": fields.List(fields.String, attribute=lambda x: json.loads(x.message_metadata).get("retriever_resources", []) if x.message_metadata else [], default=[]), ` and then restart the container by ` docker compose restart api ` hope this helps!
Author
Owner

@MichaelNie1994 commented on GitHub (Apr 10, 2025):

didn't work TT

@MichaelNie1994 commented on GitHub (Apr 10, 2025): didn't work TT
Author
Owner

@Neulhan commented on GitHub (Apr 13, 2025):

"retriever_resources": fields.List(fields.String, attribute=lambda x: json.loads(x.message_metadata).get("retriever_resources", []) if x.message_metadata else [], default=[]),

It works for me

Accessing and Editing Target File Inside the Docker Container

  1. Get inside the Docker container
docker compose exec api /bin/sh

Note: No need for -it with docker compose exec — it's implied.

  1. Install vim inside the container
apt update && apt install vim -y
  1. Edit your target file using vim
vi controllers/service_api/app/message.py
@Neulhan commented on GitHub (Apr 13, 2025): > `"retriever_resources": fields.List(fields.String, attribute=lambda x: json.loads(x.message_metadata).get("retriever_resources", []) if x.message_metadata else [], default=[]),` It works for me ✅ Accessing and Editing Target File Inside the Docker Container 1. Get inside the Docker container ```bash docker compose exec api /bin/sh ``` Note: No need for -it with docker compose exec — it's implied. 2. Install vim inside the container ```sh apt update && apt install vim -y ``` 3. Edit your target file using vim ```sh vi controllers/service_api/app/message.py ```
Author
Owner

@leecodedog commented on GitHub (Apr 25, 2025):

升级到1.30版本会有帮助吗?

@leecodedog commented on GitHub (Apr 25, 2025): 升级到1.30版本会有帮助吗?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#12769