LLM response text will be truncated after a long request #13319

Closed
opened 2026-02-21 19:11:37 -05:00 by yindo · 6 comments
Owner

Originally created by @LeeeeeeM on GitHub (Apr 24, 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.3.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image

The json text is truncated.

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @LeeeeeeM on GitHub (Apr 24, 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.3.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ![Image](https://github.com/user-attachments/assets/0de04fad-033c-43ac-ac9b-79e7878301dc) The json text is truncated. ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 19:11:37 -05:00
yindo closed this issue 2026-02-21 19:11:37 -05:00
Author
Owner

@LeeeeeeM commented on GitHub (Apr 24, 2025):

Is there any configuration field that controls the output of the ping?

@LeeeeeeM commented on GitHub (Apr 24, 2025): Is there any configuration field that controls the output of the ping?
Author
Owner

@LeeeeeeM commented on GitHub (Apr 24, 2025):

My LLM is still generating output, but Dify’s agent has already returned the text and indicated success. The full content wasn’t displayed; it was truncated.

@LeeeeeeM commented on GitHub (Apr 24, 2025): My LLM is still generating output, but Dify’s agent has already returned the text and indicated success. The full content wasn’t displayed; it was truncated.
Author
Owner

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

I found similar closed issues that might help you address the problem of truncated LLM response text in Dify:

  1. One issue suggested checking if the maximum token setting is too small, as it might be limiting the response length. Additionally, consider the possibility of a short read_timeout setting in the outer gateway, which might be causing the response to be cut off. Reviewing the reverse proxy configuration on the host machine, particularly with the mapping of ports and the use of Nginx for HTTPS and reverse proxy, was also recommended [1].

  2. Another issue recommended configuring timeout settings and token limits. You should set appropriate timeout values in your .env file, such as HTTP_REQUEST_MAX_READ_TIMEOUT and HTTP_REQUEST_MAX_WRITE_TIMEOUT, to prevent truncation. Also, ensure the max_tokens parameter is configured correctly when calling the models, as the default maximum token limit in Dify is 4096 tokens [2].

These solutions might help you resolve the issue with truncated responses in your self-hosted Dify setup.

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 24, 2025): <!-- Answer --> I found similar closed issues that might help you address the problem of truncated LLM response text in Dify: 1. One issue suggested checking if the maximum token setting is too small, as it might be limiting the response length. Additionally, consider the possibility of a short `read_timeout` setting in the outer gateway, which might be causing the response to be cut off. Reviewing the reverse proxy configuration on the host machine, particularly with the mapping of ports and the use of Nginx for HTTPS and reverse proxy, was also recommended <sup>[[1]](https://github.com/langgenius/dify/issues/15213)</sup>. 2. Another issue recommended configuring timeout settings and token limits. You should set appropriate timeout values in your `.env` file, such as `HTTP_REQUEST_MAX_READ_TIMEOUT` and `HTTP_REQUEST_MAX_WRITE_TIMEOUT`, to prevent truncation. Also, ensure the `max_tokens` parameter is configured correctly when calling the models, as the default maximum token limit in Dify is 4096 tokens <sup>[[2]](https://github.com/langgenius/dify/issues/14416)</sup>. These solutions might help you resolve the issue with truncated responses in your self-hosted Dify setup. <!-- 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/6402c9f0-136b-436b-9e71-170b70673f1e?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/6402c9f0-136b-436b-9e71-170b70673f1e?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/6402c9f0-136b-436b-9e71-170b70673f1e?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/6402c9f0-136b-436b-9e71-170b70673f1e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6402c9f0-136b-436b-9e71-170b70673f1e?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/6402c9f0-136b-436b-9e71-170b70673f1e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/6402c9f0-136b-436b-9e71-170b70673f1e?feedback_type=other)</sup>
Author
Owner

@LeeeeeeM commented on GitHub (Apr 24, 2025):

I found similar closed issues that might help you address the problem of truncated LLM response text in Dify:

  1. One issue suggested checking if the maximum token setting is too small, as it might be limiting the response length. Additionally, consider the possibility of a short read_timeout setting in the outer gateway, which might be causing the response to be cut off. Reviewing the reverse proxy configuration on the host machine, particularly with the mapping of ports and the use of Nginx for HTTPS and reverse proxy, was also recommended [1].
  2. Another issue recommended configuring timeout settings and token limits. You should set appropriate timeout values in your .env file, such as HTTP_REQUEST_MAX_READ_TIMEOUT and HTTP_REQUEST_MAX_WRITE_TIMEOUT, to prevent truncation. Also, ensure the max_tokens parameter is configured correctly when calling the models, as the default maximum token limit in Dify is 4096 tokens [2].

These solutions might help you resolve the issue with truncated responses in your self-hosted Dify setup.

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

It’s not related to settings like max_tokens. As I said, the LLM is still generating output, but the Dify API has already triggered a success event. I’ve set a large timeout value. I think it's a bug, but i cannot find it.

Image

@LeeeeeeM commented on GitHub (Apr 24, 2025): > I found similar closed issues that might help you address the problem of truncated LLM response text in Dify: > > 1. One issue suggested checking if the maximum token setting is too small, as it might be limiting the response length. Additionally, consider the possibility of a short `read_timeout` setting in the outer gateway, which might be causing the response to be cut off. Reviewing the reverse proxy configuration on the host machine, particularly with the mapping of ports and the use of Nginx for HTTPS and reverse proxy, was also recommended [[1]](https://github.com/langgenius/dify/issues/15213). > 2. Another issue recommended configuring timeout settings and token limits. You should set appropriate timeout values in your `.env` file, such as `HTTP_REQUEST_MAX_READ_TIMEOUT` and `HTTP_REQUEST_MAX_WRITE_TIMEOUT`, to prevent truncation. Also, ensure the `max_tokens` parameter is configured correctly when calling the models, as the default maximum token limit in Dify is 4096 tokens [[2]](https://github.com/langgenius/dify/issues/14416). > > These solutions might help you resolve the issue with truncated responses in your self-hosted Dify setup. > > _To continue talking to [Dosu](https://dosu.dev), mention [@dosu](https://github.com/dosu)._ > > Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/6402c9f0-136b-436b-9e71-170b70673f1e?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/6402c9f0-136b-436b-9e71-170b70673f1e?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/6402c9f0-136b-436b-9e71-170b70673f1e?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/6402c9f0-136b-436b-9e71-170b70673f1e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6402c9f0-136b-436b-9e71-170b70673f1e?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/6402c9f0-136b-436b-9e71-170b70673f1e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/6402c9f0-136b-436b-9e71-170b70673f1e?feedback_type=other) It’s not related to settings like max_tokens. As I said, the LLM is still generating output, but the Dify API has already triggered a success event. I’ve set a large timeout value. I think it's a bug, but i cannot find it. ![Image](https://github.com/user-attachments/assets/7c7f8ccd-8ed6-48a0-a8ee-462869342d0d)
Author
Owner

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

It can only stay 240s

Image

I have tried many times~!
@crazywoola

@LeeeeeeM commented on GitHub (Apr 25, 2025): It can only stay 240s ![Image](https://github.com/user-attachments/assets/ca80b220-41bd-4ff5-8422-474ce2a6fb38) I have tried many times~! @crazywoola
Author
Owner

@LeeeeeeM commented on GitHub (May 1, 2025):

The root cause of the issue wasn't a problem with the socket itself, but rather that the upstream plugin imposed a 240-second timeout on the response stream.

@LeeeeeeM commented on GitHub (May 1, 2025): The root cause of the issue wasn't a problem with the socket itself, but rather that the upstream plugin imposed a 240-second timeout on the response stream.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13319