dify icon indicating copy to clipboard operation
dify copied to clipboard

Variable Aggregator not working after Iteration node.

Open pistoolster opened this issue 7 months ago • 17 comments

Self Checks

  • [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [x] Please do not modify this template :) and fill in all the required fields.

Dify version

1.3.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When using Variable Aggregator after Iteration node of two branch, only the above branch can run into Aggregator node, the below branch stop after Iteration.

Image

✔️ Expected Behavior

either branch should run into aggregator node.

❌ Actual Behavior

the above branch works well:

Image

the below branch stopped:

Image

delete the link of above branch, also works:

Image

pistoolster avatar May 08 '25 01:05 pistoolster

I found a similar unsolved discussion regarding an input error in the Variable Aggregator [1].

Regarding your issue, the Variable Aggregator node in Dify version 1.3.1 has a known limitation where it only aggregates variables of the same data type and uses only one of the branches. It does not ensure that all branches have completed before proceeding [2]. This might be causing the behavior you're experiencing, where only one branch runs into the aggregator node while the other stops after the Iteration node.

To address this, consider using a Code node or a Template node to ensure all branches complete before proceeding, as these nodes are better suited for handling more complex data aggregation needs [2].

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] avatar May 08 '25 01:05 dosubot[bot]

See docs https://docs.dify.ai/en/guides/workflow/node/variable-aggregator#variable-aggregator

TL;DR

It only aggregates the variables, not the results.

crazywoola avatar May 08 '25 02:05 crazywoola

See docs https://docs.dify.ai/en/guides/workflow/node/variable-aggregator#variable-aggregator

TL;DR

It only aggregates the variables, not the results.

Iteration outputs(array of string) are not variables?They are results?

pistoolster avatar May 08 '25 02:05 pistoolster

Yes. From the picture above, you want to the results from both iterations. In this case, you should use code or template to merge the results into one.

crazywoola avatar May 08 '25 02:05 crazywoola

Yes. From the picture above, you want to the results from both iterations. In this case, you should use code or template to merge the results into one.

I didn't mean to get both results of iterations, i mean only one iteration node can run into aggregator, the second stopped before aggregator node.I wanted either iteration can run into aggregator node.

pistoolster avatar May 08 '25 02:05 pistoolster

Yes. From the picture above, you want to the results from both iterations. In this case, you should use code or template to merge the results into one.

Did I not describe issue clearly? What I mean is that operations after the iteration node for either branch is the same, so I need to use the aggregator node to handle the result from either branch. Isn't that the purpose of the aggregator node? Or does using the iteration node mean that I can only copy the following workflow for each branch?

pistoolster avatar May 08 '25 03:05 pistoolster

Yes. From the picture above, you want to the results from both iterations. In this case, you should use code or template to merge the results into one.

I didn't mean to get both results of iterations, i mean only one iteration node can run into aggregator, the second stopped before aggregator node.I wanted either iteration can run into aggregator node.

The variable aggregator: It chooses 1 from n branches. Once it runs into the variable aggregator, the other branch stops, this is an expected behavior.

Yes. From the picture above, you want to the results from both iterations. In this case, you should use code or template to merge the results into one.

Did I not describe issue clearly? What I mean is that operations after the iteration node for either branch is the same, so I need to use the aggregator node to handle the result from either branch. Isn't that the purpose of the aggregator node? Or does using the iteration node mean that I can only copy the following workflow for each branch?

As I said, if you want to process the branches in parallel, please use Code or Template

crazywoola avatar May 08 '25 03:05 crazywoola

Yes. From the picture above, you want to the results from both iterations. In this case, you should use code or template to merge the results into one.

I didn't mean to get both results of iterations, i mean only one iteration node can run into aggregator, the second stopped before aggregator node.I wanted either iteration can run into aggregator node.

The variable aggregator: It chooses 1 from n branches. Once it runs into the variable aggregator, the other branch stops, this is an expected behavior.

Yes. From the picture above, you want to the results from both iterations. In this case, you should use code or template to merge the results into one.

Did I not describe issue clearly? What I mean is that operations after the iteration node for either branch is the same, so I need to use the aggregator node to handle the result from either branch. Isn't that the purpose of the aggregator node? Or does using the iteration node mean that I can only copy the following workflow for each branch?

As I said, if you want to process the branches in parallel, please use Code or Template

I said 'either' again and again, why do u still think i want combine both branches results?

I've been talking about two branches of question classifier. The first branch in the image executes correctly, but the second branch stops before reaching the aggregator node, and there is no parallel situation at all.

Image

pistoolster avatar May 08 '25 03:05 pistoolster

Sorry, I have misunderstood the description. I will forward this to our backend dev to see it.

crazywoola avatar May 08 '25 03:05 crazywoola

T_T

pistoolster avatar May 08 '25 03:05 pistoolster

Sorry, I have misunderstood the description. I will forward this to our backend dev to see it.

thanks.

pistoolster avatar May 08 '25 03:05 pistoolster

Could you provide complete screenshots of the workflow or the DSL file? With this partial screenshot, I'm unable to reproduce this issue.

Nov1c444 avatar May 08 '25 07:05 Nov1c444

Could you provide complete screenshots of the workflow or the DSL file? With this partial screenshot, I'm unable to reproduce this issue.

Image

is this okay?

pistoolster avatar May 08 '25 08:05 pistoolster

Thank you for the information provided. I can reproduce it now. I'll investigate the cause of the issue.

Nov1c444 avatar May 08 '25 09:05 Nov1c444

1

dimsky avatar May 09 '25 06:05 dimsky

This question appears to be the same as #18233 #15012 #18647

Nov1c444 avatar May 13 '25 07:05 Nov1c444

I have the same problem in version 1.3.1 I use the Variable Aggregator to get 2 branches of string together. When the first branch is active, the Variable Aggregator will never works. When the second path is active, the Variable Aggregator works as expected. And it worked well in version 1.0.0

ERICMAN avatar May 17 '25 18:05 ERICMAN

Same problem.

lexmin0412 avatar May 23 '25 09:05 lexmin0412

still unfixed in version 1.5.1

pistoolster avatar Jul 10 '25 07:07 pistoolster

It seems that it has nothing to do with the Iteration node. When I aggregate the output content of the LLM nodes from two branches, the first branch does not reach this point, while the second branch can execute as expected.

pistoolster avatar Jul 10 '25 08:07 pistoolster

The same situation also occurs at the if node.

pistoolster avatar Jul 11 '25 01:07 pistoolster

Hi, @pistoolster. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that in version 1.3.1, the Variable Aggregator node only processes one branch after an Iteration node with two branches, causing the other branch to stop prematurely.
  • Clarifications from maintainers and users explained the Variable Aggregator is designed to select one branch, not aggregate multiple branches, suggesting alternative nodes for merging.
  • You emphasized the problem is that one branch never reaches the aggregator, not just about combining results, and provided screenshots to reproduce the issue.
  • A maintainer confirmed reproduction and linked this issue to similar ones, with reports that the problem persists in versions up to 1.5.1.
  • The issue remains unresolved with no current fix or workaround.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open.
  • Otherwise, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

dosubot[bot] avatar Sep 02 '25 16:09 dosubot[bot]

Hi, @pistoolster. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that in version 1.3.1, the Variable Aggregator node only processes one branch after an Iteration node with two branches, causing the other branch to stop prematurely.
  • Clarifications from maintainers and users explained the Variable Aggregator is designed to select one branch, not aggregate multiple branches, suggesting alternative nodes for merging.
  • You emphasized the problem is that one branch never reaches the aggregator, not just about combining results, and provided screenshots to reproduce the issue.
  • A maintainer confirmed reproduction and linked this issue to similar ones, with reports that the problem persists in versions up to 1.5.1.
  • The issue remains unresolved with no current fix or workaround.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open.
  • Otherwise, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

still unfixed in latest version.

pistoolster avatar Sep 03 '25 01:09 pistoolster