When calling an LLM in the DIFY workflow, the retry functionality fails when the LLM returns a status of 429. #8225

Closed
opened 2026-02-21 18:24:34 -05:00 by yindo · 2 comments
Owner

Originally created by @xiewentu on GitHub (Feb 13, 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

Dify 0.15.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

The self-built large model has a limitation that it can only concurrently process three requests per second. In Dify, the workflow is configured to retry failed requests after 2 seconds. However, the retry function is not operating as intended, failing to execute retries, which results in the workflow not running properly. This issue leads to disruptions in the workflow operations due to unsuccessful request handling.

Image

Image

Additionally, it also fails to output the default content as configured。

Image

✔️ Expected Behavior

The self-built large model has a limitation that it can only concurrently process three requests per second. In Dify, the workflow is configured to retry failed requests after 2 seconds. However, the retry function is not operating as intended, failing to execute retries, which results in the workflow not running properly. This issue leads to disruptions in the workflow operations due to unsuccessful request handling.

Actual Behavior

The entire workflow execution fails.

Originally created by @xiewentu on GitHub (Feb 13, 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 Dify 0.15.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce The self-built large model has a limitation that it can only concurrently process three requests per second. In Dify, the workflow is configured to retry failed requests after 2 seconds. However, the retry function is not operating as intended, failing to execute retries, which results in the workflow not running properly. This issue leads to disruptions in the workflow operations due to unsuccessful request handling. ![Image](https://github.com/user-attachments/assets/b3bc5929-b90a-40ac-8496-67e525680b7e) ![Image](https://github.com/user-attachments/assets/d460e469-8d1b-451c-84c1-d67e842d4e7d) Additionally, it also fails to output the default content as configured。 ![Image](https://github.com/user-attachments/assets/902d2661-103b-4f3b-87fd-8ee80ff383fa) ### ✔️ Expected Behavior The self-built large model has a limitation that it can only concurrently process three requests per second. In Dify, the workflow is configured to retry failed requests after 2 seconds. However, the retry function is not operating as intended, failing to execute retries, which results in the workflow not running properly. This issue leads to disruptions in the workflow operations due to unsuccessful request handling. ### ❌ Actual Behavior The entire workflow execution fails.
yindo added the 🐞 buggood first issue🌊 feat:workflow labels 2026-02-21 18:24:34 -05:00
yindo closed this issue 2026-02-21 18:24:34 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 13, 2025):

I found a similar open issue discussing the retry mechanism not working as expected when handling HTTP 429 errors. The suggested solution involves ensuring that the retry logic is correctly configured to handle such status codes. Specifically, you might need to adjust the conditions under which a retry is considered necessary, especially when dealing with empty results or specific error codes like 429 [1].

Additionally, Dify's workflow configuration allows customization of retry logic for specific HTTP status codes, including 429. The retry logic can be configured using a STATUS_FORCELIST that includes status codes like 429, and the retry attempts can be customized using parameters like max_retries and retry_interval [2].

To address your issue, you might want to:

  1. Verify that the STATUS_FORCELIST includes the 429 status code.
  2. Ensure that the retry configuration is correctly set up in your workflow, with appropriate values for max_retries and retry_interval.
  3. Consider implementing a more sophisticated backoff strategy that respects the Retry-After header if provided by the server.

These steps should help in managing the retry logic more effectively and ensure that the workflow can handle 429 errors as expected.

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Feb 13, 2025): <!-- Answer --> I found a similar open issue discussing the retry mechanism not working as expected when handling HTTP 429 errors. The suggested solution involves ensuring that the retry logic is correctly configured to handle such status codes. Specifically, you might need to adjust the conditions under which a retry is considered necessary, especially when dealing with empty results or specific error codes like 429 <sup>[[1]](https://github.com/langgenius/dify/issues/12746)</sup>. Additionally, Dify's workflow configuration allows customization of retry logic for specific HTTP status codes, including 429. The retry logic can be configured using a `STATUS_FORCELIST` that includes status codes like 429, and the retry attempts can be customized using parameters like `max_retries` and `retry_interval` <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/helper/ssrf_proxy.py)</sup>. To address your issue, you might want to: 1. Verify that the `STATUS_FORCELIST` includes the 429 status code. 2. Ensure that the retry configuration is correctly set up in your workflow, with appropriate values for `max_retries` and `retry_interval`. 3. Consider implementing a more sophisticated backoff strategy that respects the `Retry-After` header if provided by the server. These steps should help in managing the retry logic more effectively and ensure that the workflow can handle 429 errors as expected. <!-- 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/0f865b2e-6006-450e-a887-4ffa462a5e88?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/0f865b2e-6006-450e-a887-4ffa462a5e88?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/0f865b2e-6006-450e-a887-4ffa462a5e88?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/0f865b2e-6006-450e-a887-4ffa462a5e88?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/0f865b2e-6006-450e-a887-4ffa462a5e88?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/0f865b2e-6006-450e-a887-4ffa462a5e88?feedback_type=other) | [Bug Report](https://app.dosu.dev/response-feedback/0f865b2e-6006-450e-a887-4ffa462a5e88?feedback_type=bug_report)</sup>
Author
Owner

@Colstuwjx commented on GitHub (Feb 24, 2025):

reproduced on my local deployment as well:

2025-02-25 02:18:48.271 INFO [Thread-22 (_generate_worker)] [_base_client.py:1092] - Retrying request to /chat/completions in 8.000000 seconds
2025-02-25 02:18:57.434 INFO [Thread-22 (_generate_worker)] [_client.py:1038] - HTTP Request: POST https://openaixxx "HTTP/1.1 429 Too Many Requests"
2025-02-25 02:18:58.440 ERROR [Thread-22 (_generate_worker)] [graph_engine.py:815] - Node LLM run failed
Traceback (most recent call last):
  File "/app/api/core/workflow/graph_engine/graph_engine.py", line 626, in _run_node
    for item in generator:
                ^^^^^^^^^
  File "/app/api/core/workflow/nodes/base/node.py", line 84, in run
    yield from result
  File "/app/api/core/workflow/nodes/llm/node.py", line 212, in _run
    outputs = {"text": result_text, "usage": jsonable_encoder(usage), "finish_reason": finish_reason}
                       ^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'result_text' where it is not associated with a value
@Colstuwjx commented on GitHub (Feb 24, 2025): reproduced on my local deployment as well: ``` 2025-02-25 02:18:48.271 INFO [Thread-22 (_generate_worker)] [_base_client.py:1092] - Retrying request to /chat/completions in 8.000000 seconds 2025-02-25 02:18:57.434 INFO [Thread-22 (_generate_worker)] [_client.py:1038] - HTTP Request: POST https://openaixxx "HTTP/1.1 429 Too Many Requests" 2025-02-25 02:18:58.440 ERROR [Thread-22 (_generate_worker)] [graph_engine.py:815] - Node LLM run failed Traceback (most recent call last): File "/app/api/core/workflow/graph_engine/graph_engine.py", line 626, in _run_node for item in generator: ^^^^^^^^^ File "/app/api/core/workflow/nodes/base/node.py", line 84, in run yield from result File "/app/api/core/workflow/nodes/llm/node.py", line 212, in _run outputs = {"text": result_text, "usage": jsonable_encoder(usage), "finish_reason": finish_reason} ^^^^^^^^^^^ UnboundLocalError: cannot access local variable 'result_text' where it is not associated with a value ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8225