Inconsistent Frontend Display for LLM Streaming Output in Loops (Dify 1.11.1) #21256

Open
opened 2026-02-21 20:11:38 -05:00 by yindo · 4 comments
Owner

Originally created by @wodejiafeiyu on GitHub (Dec 24, 2025).

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.11.1

Cloud or Self Hosted

Cloud

Steps to reproduce

  1. Create an application flow containing a Loop Node in the Dify Editor;
  2. Configure an LLM call node inside the Loop Node;
  3. Set the number of loop iterations (e.g., 3 or more);
  4. Run the application and observe the content displayed in real-time on the frontend;
  5. Check the complete generated content in the backend logs
  6. Compare frontend and backend content to confirm inconsistency.

✔️ Expected Behavior

The streaming output content from LLM calls within the loop should be exactly consistent between the frontend and backend, with no missing, duplicated, or out-of-order content.

Actual Behavior

Content from some loop iterations is duplicated on the frontend;

Image
Originally created by @wodejiafeiyu on GitHub (Dec 24, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.11.1 ### Cloud or Self Hosted Cloud ### Steps to reproduce 1. Create an application flow containing a **Loop Node** in the Dify Editor; 2. Configure an LLM call node inside the Loop Node; 3. Set the number of loop iterations (e.g., 3 or more); 4. Run the application and observe the content displayed in real-time on the frontend; 5. Check the complete generated content in the backend logs 6. Compare frontend and backend content to confirm inconsistency. ### ✔️ Expected Behavior The streaming output content from LLM calls within the loop should be **exactly consistent** between the frontend and backend, with no missing, duplicated, or out-of-order content. ### ❌ Actual Behavior Content from some loop iterations is duplicated on the frontend; <img width="639" height="513" alt="Image" src="https://github.com/user-attachments/assets/b6fa737d-d980-4e1d-93c3-fc1473b0e11b" />
yindo added the 🐞 bug label 2026-02-21 20:11:38 -05:00
Author
Owner

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

Hi @wodejiafeiyu! I'm Dosu and I’m helping the dify team.

This appears to be a real backend/frontend sync issue with streaming output in loop nodes. The backend LoopNode logic is designed to clear variables between iterations and accumulate outputs to avoid duplication, and it emits streaming events for each chunk of LLM output, which the frontend should render in real time. However, the frontend may be mishandling these events, leading to duplicated content display, even though the backend logs remain correct. No recent pull requests address this specific bug, and there are no documented workarounds yet. Reviewing how the frontend processes StreamChunkEvent and StreamCompletedEvent for looped LLM calls may help pinpoint the cause. For now, there isn’t a configuration change known to mitigate this issue.
You can review the backend event logic here: LoopNode implementation and streaming event classes.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 24, 2025): <!-- Greeting --> Hi @wodejiafeiyu! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> This appears to be a real backend/frontend sync issue with streaming output in loop nodes. The backend LoopNode logic is designed to clear variables between iterations and accumulate outputs to avoid duplication, and it emits streaming events for each chunk of LLM output, which the frontend should render in real time. However, the frontend may be mishandling these events, leading to duplicated content display, even though the backend logs remain correct. No recent pull requests address this specific bug, and there are no documented workarounds yet. Reviewing how the frontend processes StreamChunkEvent and StreamCompletedEvent for looped LLM calls may help pinpoint the cause. For now, there isn’t a configuration change known to mitigate this issue. You can review the backend event logic here: [LoopNode implementation](https://github.com/langgenius/dify/blob/18d69775ef6750e407409973ca4412e763bb214e/api/core/workflow/nodes/loop/loop_node.py#L55-L457) and [streaming event classes](https://github.com/langgenius/dify/blob/18d69775ef6750e407409973ca4412e763bb214e/api/core/workflow/node_events/node.py#L35-L46). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/b0dd0fa5-370f-4933-b362-0734a3c0fae4?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/b0dd0fa5-370f-4933-b362-0734a3c0fae4?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/b0dd0fa5-370f-4933-b362-0734a3c0fae4?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/b0dd0fa5-370f-4933-b362-0734a3c0fae4?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b0dd0fa5-370f-4933-b362-0734a3c0fae4?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/b0dd0fa5-370f-4933-b362-0734a3c0fae4?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b0dd0fa5-370f-4933-b362-0734a3c0fae4?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20appears%20to%20be%20a%20real%20backend/frontend%20sync%20issue%20with%20streaming%20output%20in%20loop%20nodes.%20The%20backend%20LoopNode%20logic%20is%20designed%20to%20clear%20variables%20between%20iterations%20and%20accumulate%20outputs%20to%20avoid%20duplication%2C%20and%20it%20emits%20streaming%20events%20for%20each%20chunk%20of%20LLM%20output%2C%20which%20the%20frontend%20should%20render%20in%20real%20time.%20However%2C%20the%20frontend%20may%20be%20mishandling%20these%20events%2C%20leading%20to%20duplicated%20content%20display%2C%20even%20though%20the%20backend%20logs%20remain%20correct.%20No%20recent%20pull%20requests%20address%20this%20specific%20bug%2C%20and%20there%20are%20no%20documented%20workarounds%20yet.%20Reviewing%20how%20the%20frontend%20processes%20StreamChunkEvent%20and%20StreamCompletedEvent%20for%20looped%20LLM%20calls%20may%20help%20pinpoint%20the%20cause.%20For%20now%2C%20there%20isn%E2%80%99t%20a%20configuration%20change%20known%20to%20mitigate%20this%20issue.%20%20%0AYou%20can%20review%20the%20backend%20event%20logic%20here%3A%20%5BLoopNode%20implementation%5D%28https%3A//github.com/langgenius/dify/blob/18d69775ef6750e407409973ca4412e763bb214e/api/core/workflow/nodes/loop/loop_node.py%23L55-L457%29%20and%20%5Bstreaming%20event%20classes%5D%28https%3A//github.com/langgenius/dify/blob/18d69775ef6750e407409973ca4412e763bb214e/api/core/workflow/node_events/node.py%23L35-L46%29.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/30097)
Author
Owner

@RubberDuck-whiteEaves commented on GitHub (Feb 2, 2026):

@wodejiafeiyu Has the problem been resolved?

@RubberDuck-whiteEaves commented on GitHub (Feb 2, 2026): @wodejiafeiyu Has the problem been resolved?
Author
Owner

@dosubot[bot] commented on GitHub (Feb 2, 2026):

@crazywoola The user @RubberDuck-whiteEaves is asking if the backend/frontend sync issue with streaming output in loop nodes has been resolved. Could you please assist with this?

@dosubot[bot] commented on GitHub (Feb 2, 2026): @crazywoola The user @RubberDuck-whiteEaves is asking if the backend/frontend sync issue with streaming output in loop nodes has been resolved. Could you please assist with this?
Author
Owner

@RubberDuck-whiteEaves commented on GitHub (Feb 2, 2026):

I encountered the same problem. When I stream the output of a large model in a loop, the output of the second loop is the same as the output of the first loop, and the value of the third output is actually the output of the second loop.

@RubberDuck-whiteEaves commented on GitHub (Feb 2, 2026): I encountered the same problem. When I stream the output of a large model in a loop, the output of the second loop is the same as the output of the first loop, and the value of the third output is actually the output of the second loop.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#21256