Conditional branch error: Two parallel if-else nodes are placed side by side. If the else branch of the above if-else node is connected to the else branch of the below if-else node, the following else branch will be executed. #15236

Closed
opened 2026-02-21 19:20:49 -05:00 by yindo · 2 comments
Owner

Originally created by @chenyi-666 on GitHub (Jul 10, 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

1.5.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Step 1: Add two parameters to the workflow start node, named qq and vx
Step 2: Place two parallel if-else branches side by side after the start node. The condition of the first if-else branch is that when qq contains 3, execute the if branch, otherwise execute the else branch. Add an end node 3 after the if branch and output qq
Step 3: The condition of the second if-else node is that when vx contains 6, execute the if branch, otherwise execute the else branch. Add an end node 4 after the else branch of the second if-else node and output vx
Step 4: Connect the else branch of the first if-else node to the elseffe branch of the second if-else node, that is, the else branches of the two if-else branches share the same branch
Step 5: Run the workflow, enter 3 for the value of qq and 6 for the value of vx in the input box, start running and view the results

Image

✔️ Expected Behavior

Branches that should not be executed do not need to be executed

Actual Behavior

Because the input qq and vx values ​​​​of workflow make the two if-else nodes execute if branches, but the second if-else node does not configure if branches, no branches will be executed; the first if-else node configures if branches and else branches, but because the conditions for executing if branches are met, the else branch will not be executed, but the result is that the else branch is executed

Originally created by @chenyi-666 on GitHub (Jul 10, 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 1.5.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Step 1: Add two parameters to the workflow start node, named qq and vx Step 2: Place two parallel if-else branches side by side after the start node. The condition of the first if-else branch is that when qq contains 3, execute the if branch, otherwise execute the else branch. Add an end node 3 after the if branch and output qq Step 3: The condition of the second if-else node is that when vx contains 6, execute the if branch, otherwise execute the else branch. Add an end node 4 after the else branch of the second if-else node and output vx Step 4: Connect the else branch of the first if-else node to the elseffe branch of the second if-else node, that is, the else branches of the two if-else branches share the same branch Step 5: Run the workflow, enter 3 for the value of qq and 6 for the value of vx in the input box, start running and view the results <img width="1411" height="513" alt="Image" src="https://github.com/user-attachments/assets/a4aa8ad6-64fd-46ec-9b1e-07b2b8173400" /> ### ✔️ Expected Behavior Branches that should not be executed do not need to be executed ### ❌ Actual Behavior Because the input qq and vx values ​​​​of workflow make the two if-else nodes execute if branches, but the second if-else node does not configure if branches, no branches will be executed; the first if-else node configures if branches and else branches, but because the conditions for executing if branches are met, the else branch will not be executed, but the result is that the else branch is executed
yindo closed this issue 2026-02-21 19:20:49 -05:00
Author
Owner

@crazywoola commented on GitHub (Jul 10, 2025):

It seems duplicated with https://github.com/langgenius/dify/issues/22124

@crazywoola commented on GitHub (Jul 10, 2025): It seems duplicated with https://github.com/langgenius/dify/issues/22124
Author
Owner

@dosubot[bot] commented on GitHub (Jul 10, 2025):

This is a real architectural limitation in Dify's workflow engine. When you merge else branches from parallel if-else nodes into a shared downstream node, the engine may activate that shared node if any eligible upstream path exists—even if, logically, neither else branch should run because both if conditions were met. The engine doesn't strictly isolate execution context for each branch, so unintended execution can happen when merging parallel branches like this. There isn't a documented workaround or fix yet.

To avoid this, try not to merge else branches from parallel if-else nodes into a single shared node. Instead, keep branches separate or redesign the workflow so each branch leads to its own unique downstream node. This will help prevent ambiguous execution paths until the engine's branching logic is improved.

If you need to track this for future updates, keep an eye on release notes or discussions about stricter branch execution context in the workflow engine.

For more technical details, see the relevant code logic in the IfElseNode and GraphEngine classes.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Jul 10, 2025): <!-- Answer --> This is a real architectural limitation in Dify's workflow engine. When you merge else branches from parallel if-else nodes into a shared downstream node, the engine may activate that shared node if any eligible upstream path exists—even if, logically, neither else branch should run because both if conditions were met. The engine doesn't strictly isolate execution context for each branch, so unintended execution can happen when merging parallel branches like this. There isn't a documented workaround or fix yet. To avoid this, try not to merge else branches from parallel if-else nodes into a single shared node. Instead, keep branches separate or redesign the workflow so each branch leads to its own unique downstream node. This will help prevent ambiguous execution paths until the engine's branching logic is improved. If you need to track this for future updates, keep an eye on release notes or discussions about stricter branch execution context in the workflow engine. For more technical details, see the relevant code logic in the [IfElseNode](https://github.com/langgenius/dify/blob/10858ea1dc33ba7951841e4a31f220a98869159f/api/core/workflow/nodes/if_else/if_else_node.py) and [GraphEngine](https://github.com/langgenius/dify/blob/10858ea1dc33ba7951841e4a31f220a98869159f/api/core/workflow/graph_engine/graph_engine.py) classes. <!-- 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/7a012d53-8806-4652-8a0d-16924094f86f?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/7a012d53-8806-4652-8a0d-16924094f86f?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/7a012d53-8806-4652-8a0d-16924094f86f?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/7a012d53-8806-4652-8a0d-16924094f86f?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/7a012d53-8806-4652-8a0d-16924094f86f?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/7a012d53-8806-4652-8a0d-16924094f86f?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/7a012d53-8806-4652-8a0d-16924094f86f?feedback_type=other)</sup>&nbsp;&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/22135)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#15236