in loop node, no matter which time it is, answer node always display the first time's output #20797

Closed
opened 2026-02-21 20:09:01 -05:00 by yindo · 1 comment
Owner

Originally created by @Covfefeable on GitHub (Dec 4, 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.10.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

according to the image

Image

✔️ Expected Behavior

each answer node displays the correct content

Actual Behavior

each answer node always displays the first loop's content

Originally created by @Covfefeable on GitHub (Dec 4, 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.10.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce according to the image <img width="3598" height="1980" alt="Image" src="https://github.com/user-attachments/assets/029b0f05-5d04-4d0e-ab40-65751d67d907" /> ### ✔️ Expected Behavior each answer node displays the correct content ### ❌ Actual Behavior each answer node always displays the first loop's content
yindo added the 🐞 bug label 2026-02-21 20:09:01 -05:00
yindo closed this issue 2026-02-21 20:09:01 -05:00
Author
Owner

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

This issue happens because, in the backend, the loop node accumulates outputs from each iteration, but for the "answer" key, it concatenates all outputs together rather than keeping them separate per iteration. The frontend answer node then just displays the first (or sometimes the concatenated) output, not the correct one for each loop iteration. This is a limitation in how outputs are aggregated and rendered for answer nodes inside loops—there’s no logic to distinguish or display per-iteration results in the UI. You can see this in the backend loop node implementation, where answer outputs are concatenated with a newline rather than stored as a list or mapped by iteration index (source).

Recent pull requests have focused on token counting and usage tracking, not on fixing this output rendering issue. There’s no evidence of a workaround or fix in v1.10.1. For now, you may need to wait for an update that changes how loop outputs are handled, or consider a custom workaround by post-processing the outputs if you need per-iteration answers.

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 4, 2025): <!-- Answer --> This issue happens because, in the backend, the loop node accumulates outputs from each iteration, but for the "answer" key, it concatenates all outputs together rather than keeping them separate per iteration. The frontend answer node then just displays the first (or sometimes the concatenated) output, not the correct one for each loop iteration. This is a limitation in how outputs are aggregated and rendered for answer nodes inside loops—there’s no logic to distinguish or display per-iteration results in the UI. You can see this in the backend loop node implementation, where answer outputs are concatenated with a newline rather than stored as a list or mapped by iteration index ([source](https://github.com/langgenius/dify/blob/63d8fe876e1e2cbc122dc1a028c594fc21c7abd2/api/core/workflow/nodes/loop/loop_node.py#L43-L277)). Recent pull requests have focused on token counting and usage tracking, not on fixing this output rendering issue. There’s no evidence of a workaround or fix in v1.10.1. For now, you may need to wait for an update that changes how loop outputs are handled, or consider a custom workaround by post-processing the outputs if you need per-iteration answers. <!-- 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/b1445753-c8c2-4318-b19b-0453acf601ac?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/b1445753-c8c2-4318-b19b-0453acf601ac?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/b1445753-c8c2-4318-b19b-0453acf601ac?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/b1445753-c8c2-4318-b19b-0453acf601ac?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b1445753-c8c2-4318-b19b-0453acf601ac?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/b1445753-c8c2-4318-b19b-0453acf601ac?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b1445753-c8c2-4318-b19b-0453acf601ac?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%20issue%20happens%20because%2C%20in%20the%20backend%2C%20the%20loop%20node%20accumulates%20outputs%20from%20each%20iteration%2C%20but%20for%20the%20%22answer%22%20key%2C%20it%20concatenates%20all%20outputs%20together%20rather%20than%20keeping%20them%20separate%20per%20iteration.%20The%20frontend%20answer%20node%20then%20just%20displays%20the%20first%20%28or%20sometimes%20the%20concatenated%29%20output%2C%20not%20the%20correct%20one%20for%20each%20loop%20iteration.%20This%20is%20a%20limitation%20in%20how%20outputs%20are%20aggregated%20and%20rendered%20for%20answer%20nodes%20inside%20loops%E2%80%94there%E2%80%99s%20no%20logic%20to%20distinguish%20or%20display%20per-iteration%20results%20in%20the%20UI.%20You%20can%20see%20this%20in%20the%20backend%20loop%20node%20implementation%2C%20where%20answer%20outputs%20are%20concatenated%20with%20a%20newline%20rather%20than%20stored%20as%20a%20list%20or%20mapped%20by%20iteration%20index%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/blob/63d8fe876e1e2cbc122dc1a028c594fc21c7abd2/api/core/workflow/nodes/loop/loop_node.py%23L43-L277%29%29.%0A%0ARecent%20pull%20requests%20have%20focused%20on%20token%20counting%20and%20usage%20tracking%2C%20not%20on%20fixing%20this%20output%20rendering%20issue.%20There%E2%80%99s%20no%20evidence%20of%20a%20workaround%20or%20fix%20in%20v1.10.1.%20For%20now%2C%20you%20may%20need%20to%20wait%20for%20an%20update%20that%20changes%20how%20loop%20outputs%20are%20handled%2C%20or%20consider%20a%20custom%20workaround%20by%20post-processing%20the%20outputs%20if%20you%20need%20per-iteration%20answers.)&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/29141)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20797