Error in obtaining session history message API #13066

Closed
opened 2026-02-21 19:10:24 -05:00 by yindo · 3 comments
Owner

Originally created by @tphp on GitHub (Apr 17, 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

/v1/messages?user=SMC-SZ-HR21007&conversation_id=81cab61e-8c7a-4fb5-8748-8e377ad50fb9

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Error reported when accessing the API:
/v1/messages?user=xxxx&conversation_id=xxxx

Return result:
{
"message": "Internal Server Error",
"code": "unknown"
}

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @tphp on GitHub (Apr 17, 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 /v1/messages?user=SMC-SZ-HR21007&conversation_id=81cab61e-8c7a-4fb5-8748-8e377ad50fb9 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Error reported when accessing the API: /v1/messages?user=xxxx&conversation_id=xxxx Return result: { "message": "Internal Server Error", "code": "unknown" } ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 19:10:24 -05:00
yindo closed this issue 2026-02-21 19:10:24 -05:00
Author
Owner

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

Hello @tphp! I'm Dosu, your friendly bot here to help you with bugs, answer your questions, and guide you towards becoming a contributor. I'm here while you wait for a human maintainer to assist you. How can I help you today?

I found similar threads related to the "Internal Server Error" when accessing the session history message interface in a self-hosted Dify setup:

  1. Internal Server Error - This discussion is open and might contain useful insights for your issue [1].
  2. Get /messages API encountered Internal Server Error - This issue was closed with a fix applied in a pull request [2].

To resolve the "Internal Server Error," you can try the following steps:

  1. Use the alternative endpoint /v1/chat-messages instead of /v1/messages [3].

  2. Apply the fix from the main branch by modifying the code in your Docker container using commit 63ba6077387ce5b0c1d4dd58079f9e8596240816 [3].

  3. Check your Docker setup:

    • Ensure that your environment variables and configurations are correctly set, especially URLs, database, Redis, and Celery configurations [4].
    • Use 'host.docker.internal' instead of 'localhost' or '127.0.0.1' for proper Docker container service access [5].
  4. Check the logs of the 'api' container to diagnose the issue using:

    docker-compose logs api
    ``` <sup>[[6]](https://github.com/langgenius/dify/issues/14504)</sup>.
    
    

These steps should help in resolving the error you're encountering.

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 17, 2025): <!-- Greeting --> Hello @tphp! I'm [Dosu](https://dosu.dev), your friendly bot here to help you with bugs, answer your questions, and guide you towards becoming a contributor. I'm here while you wait for a human maintainer to assist you. How can I help you today? <!-- Answer --> I found similar threads related to the "Internal Server Error" when accessing the session history message interface in a self-hosted Dify setup: 1. **[Internal Server Error](https://github.com/langgenius/dify/discussions/17492)** - This discussion is open and might contain useful insights for your issue <sup>[[1]](https://github.com/langgenius/dify/discussions/17492)</sup>. 2. **[Get `/messages` API encountered Internal Server Error](https://github.com/langgenius/dify/issues/17712)** - This issue was closed with a fix applied in a pull request <sup>[[2]](https://github.com/langgenius/dify/issues/17712)</sup>. To resolve the "Internal Server Error," you can try the following steps: 1. **Use the alternative endpoint** `/v1/chat-messages` instead of `/v1/messages` <sup>[[3]](https://github.com/langgenius/dify/issues/17805)</sup>. 2. **Apply the fix from the main branch** by modifying the code in your Docker container using commit `63ba6077387ce5b0c1d4dd58079f9e8596240816` <sup>[[3]](https://github.com/langgenius/dify/issues/17805)</sup>. 3. **Check your Docker setup**: - Ensure that your environment variables and configurations are correctly set, especially URLs, database, Redis, and Celery configurations <sup>[[4]](https://github.com/langgenius/dify/issues/6479)</sup>. - Use 'host.docker.internal' instead of 'localhost' or '127.0.0.1' for proper Docker container service access <sup>[[5]](https://github.com/langgenius/dify/issues/11785)</sup>. 4. **Check the logs** of the 'api' container to diagnose the issue using: ```bash docker-compose logs api ``` <sup>[[6]](https://github.com/langgenius/dify/issues/14504)</sup>. These steps should help in resolving the error you're encountering. <!-- 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/cba7263b-029b-4a4f-832d-2358302365cd?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/cba7263b-029b-4a4f-832d-2358302365cd?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/cba7263b-029b-4a4f-832d-2358302365cd?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/cba7263b-029b-4a4f-832d-2358302365cd?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/cba7263b-029b-4a4f-832d-2358302365cd?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/cba7263b-029b-4a4f-832d-2358302365cd?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/cba7263b-029b-4a4f-832d-2358302365cd?feedback_type=other)</sup>
Author
Owner

@tphp commented on GitHub (Apr 17, 2025):

2025-04-17 07:57:27.660 ERROR [Dummy-12] [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
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
else make(v).output(k, data))
^^^^^^^^^^^^^^
AttributeError: 'function' object has no attribute 'output'

@tphp commented on GitHub (Apr 17, 2025): 2025-04-17 07:57:27.660 ERROR [Dummy-12] [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'
Author
Owner

@crazywoola commented on GitHub (Apr 17, 2025):

fix: 17712-get-messages-api-encountered-internal-server-error (#17716)

@crazywoola commented on GitHub (Apr 17, 2025): fix: 17712-get-messages-api-encountered-internal-server-error (#17716)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13066