The node can't be executed if it is connected to both the if and else branches. #7644

Closed
opened 2026-02-21 18:21:37 -05:00 by yindo · 1 comment
Owner

Originally created by @liuzhenghua on GitHub (Jan 9, 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

0.9.2

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

The node can't be executed if it is connected to both the if and else branches.

app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: advanced-chat
  name: 并行流问题验证
  use_icon_as_answer_icon: false
kind: app
version: 0.1.2
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload:
      image:
        enabled: false
        number_limits: 3
        transfer_methods:
        - local_file
        - remote_url
    opening_statement: ''
    retriever_resource:
      enabled: true
    sensitive_word_avoidance:
      enabled: false
    speech_to_text:
      enabled: false
    suggested_questions: []
    suggested_questions_after_answer:
      enabled: false
    text_to_speech:
      enabled: false
      language: ''
      voice: ''
  graph:
    edges:
    - data:
        isInIteration: false
        sourceType: start
        targetType: code
      id: 1736483932029-source-1736484018043-target
      source: '1736483932029'
      sourceHandle: source
      target: '1736484018043'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: start
        targetType: if-else
      id: 1736483932029-source-1736484036958-target
      source: '1736483932029'
      sourceHandle: source
      target: '1736484036958'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: answer
      id: 1736484036958-true-1736484058927-target
      source: '1736484036958'
      sourceHandle: 'true'
      target: '1736484058927'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: code
      id: 1736484036958-false-1736484106283-target
      source: '1736484036958'
      sourceHandle: 'false'
      target: '1736484106283'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: code
        targetType: answer
      id: 1736484018043-source-answer-target
      source: '1736484018043'
      sourceHandle: source
      target: answer
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: code
        targetType: answer
      id: 1736484106283-source-answer-target
      source: '1736484106283'
      sourceHandle: source
      target: answer
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: code
      id: 1736484036958-true-1736484106283-target
      source: '1736484036958'
      sourceHandle: 'true'
      target: '1736484106283'
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: 开始
        type: start
        variables: []
      height: 53
      id: '1736483932029'
      position:
        x: 80
        y: 282
      positionAbsolute:
        x: 80
        y: 282
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        answer: 'result 1: {{#1736484018043.result#}}

          result 2: {{#1736484106283.result#}}'
        desc: ''
        selected: false
        title: 直接回复
        type: answer
        variables: []
      height: 125
      id: answer
      position:
        x: 1111
        y: 427
      positionAbsolute:
        x: 1111
        y: 427
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        code: "\ndef main() -> dict:\n    return {\n        \"result\": 1,\n    }\n"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: number
        selected: false
        title: 代码执行1
        type: code
        variables: []
      height: 53
      id: '1736484018043'
      position:
        x: 500
        y: 155
      positionAbsolute:
        x: 500
        y: 155
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        cases:
        - case_id: 'true'
          conditions:
          - comparison_operator: contains
            id: e2cd4e17-0b5b-4512-ade8-b0ce699964c9
            value: test parallel
            varType: string
            variable_selector:
            - sys
            - query
          id: 'true'
          logical_operator: and
        desc: ''
        selected: false
        title: 条件分支
        type: if-else
      height: 125
      id: '1736484036958'
      position:
        x: 387
        y: 413
      positionAbsolute:
        x: 387
        y: 413
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        answer: IF
        desc: ''
        selected: false
        title: 直接回复 2
        type: answer
        variables: []
      height: 103
      id: '1736484058927'
      position:
        x: 690
        y: 413
      positionAbsolute:
        x: 690
        y: 413
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        code: "\ndef main() -> dict:\n    return {\n        \"result\": 2,\n    }\n"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: number
        selected: false
        title: 代码执行 2
        type: code
        variables: []
      height: 53
      id: '1736484106283'
      position:
        x: 690
        y: 555
      positionAbsolute:
        x: 690
        y: 555
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    viewport:
      x: 43.85324998620399
      y: 160.05043883833406
      zoom: 0.6597539553864471

✔️ Expected Behavior

代码执行2 node can be executed.
image

Actual Behavior

代码执行2 node can not be executed.
image

Originally created by @liuzhenghua on GitHub (Jan 9, 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 0.9.2 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce The node can't be executed if it is connected to both the if and else branches. ```yaml app: description: '' icon: 🤖 icon_background: '#FFEAD5' mode: advanced-chat name: 并行流问题验证 use_icon_as_answer_icon: false kind: app version: 0.1.2 workflow: conversation_variables: [] environment_variables: [] features: file_upload: image: enabled: false number_limits: 3 transfer_methods: - local_file - remote_url opening_statement: '' retriever_resource: enabled: true sensitive_word_avoidance: enabled: false speech_to_text: enabled: false suggested_questions: [] suggested_questions_after_answer: enabled: false text_to_speech: enabled: false language: '' voice: '' graph: edges: - data: isInIteration: false sourceType: start targetType: code id: 1736483932029-source-1736484018043-target source: '1736483932029' sourceHandle: source target: '1736484018043' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false sourceType: start targetType: if-else id: 1736483932029-source-1736484036958-target source: '1736483932029' sourceHandle: source target: '1736484036958' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false sourceType: if-else targetType: answer id: 1736484036958-true-1736484058927-target source: '1736484036958' sourceHandle: 'true' target: '1736484058927' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false sourceType: if-else targetType: code id: 1736484036958-false-1736484106283-target source: '1736484036958' sourceHandle: 'false' target: '1736484106283' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false sourceType: code targetType: answer id: 1736484018043-source-answer-target source: '1736484018043' sourceHandle: source target: answer targetHandle: target type: custom zIndex: 0 - data: isInIteration: false sourceType: code targetType: answer id: 1736484106283-source-answer-target source: '1736484106283' sourceHandle: source target: answer targetHandle: target type: custom zIndex: 0 - data: isInIteration: false sourceType: if-else targetType: code id: 1736484036958-true-1736484106283-target source: '1736484036958' sourceHandle: 'true' target: '1736484106283' targetHandle: target type: custom zIndex: 0 nodes: - data: desc: '' selected: false title: 开始 type: start variables: [] height: 53 id: '1736483932029' position: x: 80 y: 282 positionAbsolute: x: 80 y: 282 sourcePosition: right targetPosition: left type: custom width: 243 - data: answer: 'result 1: {{#1736484018043.result#}} result 2: {{#1736484106283.result#}}' desc: '' selected: false title: 直接回复 type: answer variables: [] height: 125 id: answer position: x: 1111 y: 427 positionAbsolute: x: 1111 y: 427 selected: false sourcePosition: right targetPosition: left type: custom width: 243 - data: code: "\ndef main() -> dict:\n return {\n \"result\": 1,\n }\n" code_language: python3 desc: '' outputs: result: children: null type: number selected: false title: 代码执行1 type: code variables: [] height: 53 id: '1736484018043' position: x: 500 y: 155 positionAbsolute: x: 500 y: 155 selected: false sourcePosition: right targetPosition: left type: custom width: 243 - data: cases: - case_id: 'true' conditions: - comparison_operator: contains id: e2cd4e17-0b5b-4512-ade8-b0ce699964c9 value: test parallel varType: string variable_selector: - sys - query id: 'true' logical_operator: and desc: '' selected: false title: 条件分支 type: if-else height: 125 id: '1736484036958' position: x: 387 y: 413 positionAbsolute: x: 387 y: 413 selected: false sourcePosition: right targetPosition: left type: custom width: 243 - data: answer: IF desc: '' selected: false title: 直接回复 2 type: answer variables: [] height: 103 id: '1736484058927' position: x: 690 y: 413 positionAbsolute: x: 690 y: 413 selected: false sourcePosition: right targetPosition: left type: custom width: 243 - data: code: "\ndef main() -> dict:\n return {\n \"result\": 2,\n }\n" code_language: python3 desc: '' outputs: result: children: null type: number selected: false title: 代码执行 2 type: code variables: [] height: 53 id: '1736484106283' position: x: 690 y: 555 positionAbsolute: x: 690 y: 555 selected: true sourcePosition: right targetPosition: left type: custom width: 243 viewport: x: 43.85324998620399 y: 160.05043883833406 zoom: 0.6597539553864471 ``` ### ✔️ Expected Behavior 代码执行2 node can be executed. ![image](https://github.com/user-attachments/assets/5eefe3f1-7281-4f20-9999-918803052c69) ### ❌ Actual Behavior 代码执行2 node can not be executed. ![image](https://github.com/user-attachments/assets/5fb298b8-405e-4a62-bcb1-71fc5cc777fd)
yindo added the 🌊 feat:workflow label 2026-02-21 18:21:37 -05:00
yindo closed this issue 2026-02-21 18:21:37 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 9, 2025):

In Dify version 0.9.2, the issue where a node cannot be executed when connected to both the if and else branches is a known problem. This occurs because the condition of the second branch becomes invalid when multiple paths connect the IF/ELSE branches, leading to the execution of all subsequent paths.

To address this, you can try the following workaround:

  1. Add an Empty Component: Insert an empty component, such as an empty variable assignment, in all paths between the IF/ELSE branches. This can help prevent the condition from becoming invalid and ensure that the correct path is executed.

This workaround is based on a similar issue observed in later versions of Dify, and it might help mitigate the problem in version 0.9.2 as well [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Jan 9, 2025): <!-- Answer --> In Dify version 0.9.2, the issue where a node cannot be executed when connected to both the if and else branches is a known problem. This occurs because the condition of the second branch becomes invalid when multiple paths connect the IF/ELSE branches, leading to the execution of all subsequent paths. To address this, you can try the following workaround: 1. **Add an Empty Component**: Insert an empty component, such as an empty variable assignment, in all paths between the IF/ELSE branches. This can help prevent the condition from becoming invalid and ensure that the correct path is executed. This workaround is based on a similar issue observed in later versions of Dify, and it might help mitigate the problem in version 0.9.2 as well <sup>[[1]](https://github.com/langgenius/dify/issues/11542)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/b92e7c66-320d-470e-95cb-47d75a7dbf5a?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/b92e7c66-320d-470e-95cb-47d75a7dbf5a?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/b92e7c66-320d-470e-95cb-47d75a7dbf5a?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/b92e7c66-320d-470e-95cb-47d75a7dbf5a?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b92e7c66-320d-470e-95cb-47d75a7dbf5a?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/b92e7c66-320d-470e-95cb-47d75a7dbf5a?feedback_type=other)</sup>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7644