General Discussion #38799
Replies: 1 comment
|
Hi @tech-cove01! I'm Dosu and I'm helping the Dify team. This is a well-known pain point with branch convergence in Dify workflows. Here's what I found that may help: Why it happens: In v1.15.0, Dify's pre-rendering validation checks variable availability before Jinja2 templates evaluate, so even Variable Aggregator — it actually can help, with the right setup: The Variable Aggregator is designed exactly for mutually-exclusive branches (if/else, question classifier). It automatically outputs the value from whichever branch actually executed and silently ignores skipped branches [2]. The key detail is that it always produces a single If you need to merge multiple different variables from your branches, the pattern is:
There's also an "Aggregate All" mode (added in a 2025 update) that collects ALL resolved inputs into a list rather than just picking the first valid one — useful if multiple branches can execute in parallel [4]. Active improvements coming:
Recommended pattern for your use case: This should eliminate the "Variable Not Found" crash without needing separate Answer nodes per branch. If each branch produces multiple variables you need downstream, add one aggregator per variable. Would you like me to dig deeper into the Variable Aggregator configuration or the grouping feature specifically? To reply, just mention @dosu. Share context across your team and agents. Try Dosu. |
Uh oh!
There was an error while loading. Please reload this page.
Self Checks
Content
Title: Chatflow Bug: Variable Not Found during branch convergence & Aggregator limitations
Hey guys, wanted to share a major headache I ran into with Dify’s Chatflow engine regarding branch convergence and the Variable Aggregator.
The Flaw:
If you have multiple conditional branches that eventually merge into a single downstream LLM node, you'll run into a breaking issue. If any upstream branch is skipped, its output variables become Undefined. When the downstream LLM tries to read the template, Dify throws a Variable Not Found error and completely freezes the workflow.
Why the Variable Aggregator doesn't help:
The Aggregator node is too limited. Without grouping, you can only add a single variable. Even with grouping turned on, it still only outputs one variable from whichever path was executed. It acts as a selector, but it cannot merge or fuse multiple variables together into a single object for downstream nodes.
Our Workaround:
To bypass this variable-swallowing bug, we had to dump the single-merge design and use a "Multi-Endpoint Architecture." Basically, each functional path (QA, Refactoring, Coding) gets its own dedicated LLM and Answer node to close the loop independently. It 100% fixes the crash, but it makes the canvas massive and messy.
Has anyone found a cleaner way to fuse variables from parallel branches without multiplying downstream nodes?
All reactions