Bug: getNodeUsedVars always returns an empty array for If-Else node and Question-Classification node #15162

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

Originally created by @Minamiyama on GitHub (Jul 7, 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.0

Cloud or Self Hosted

Self Hosted (Source), Self Hosted (Docker)

Steps to reproduce

When calling getNodeUsedVars, if the supplied node is of type If-Else or Question-Classification, the method consistently returns an empty array instead of the expected list of referenced variables. This prevents us from identifying which variables are actually used by these nodes.

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @Minamiyama on GitHub (Jul 7, 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.0 ### Cloud or Self Hosted Self Hosted (Source), Self Hosted (Docker) ### Steps to reproduce When calling getNodeUsedVars, if the supplied node is of type If-Else or Question-Classification, the method consistently returns an empty array instead of the expected list of referenced variables. This prevents us from identifying which variables are actually used by these nodes. ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 19:20:29 -05:00
yindo closed this issue 2026-02-21 19:20:29 -05:00
Author
Owner

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

Hi @Minamiyama! I'm Dosu and I’m helping the dify team.

This is a known limitation in Dify 1.5.0: the getNodeUsedVars function does not fully extract variables from nested properties in If-Else and Question-Classification nodes, so it returns an empty array even when variables are referenced. This happens because the function only looks at top-level properties and misses variables inside conditions or class definitions for these node types.

A recent update fixes this—PR #21987 improves getNodeUsedVars to correctly extract variables from conditions in If-Else nodes and from class contents in Question-Classification nodes. Updating to a version that includes this PR will resolve the issue. If you can't update right away, a workaround is to ensure all variable selectors are explicitly populated in your node configuration, but the real fix is in the updated code logic.
See PR #21987 for details
See implementation details

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 7, 2025): <!-- Greeting --> Hi @Minamiyama! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> This is a known limitation in Dify 1.5.0: the getNodeUsedVars function does not fully extract variables from nested properties in If-Else and Question-Classification nodes, so it returns an empty array even when variables are referenced. This happens because the function only looks at top-level properties and misses variables inside conditions or class definitions for these node types. A recent update fixes this—PR #21987 improves getNodeUsedVars to correctly extract variables from conditions in If-Else nodes and from class contents in Question-Classification nodes. Updating to a version that includes this PR will resolve the issue. If you can't update right away, a workaround is to ensure all variable selectors are explicitly populated in your node configuration, but the real fix is in the updated code logic. [See PR #21987 for details](https://github.com/langgenius/dify/pull/21987) [See implementation details](https://github.com/langgenius/dify/blob/17601790930fda15338f846654f7c50ae3c9be7e/web/app/components/workflow/nodes/_base/components/variable/utils.ts) <!-- 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/88a0589d-95b8-4ed6-8236-1ad2d8e7ecea?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/88a0589d-95b8-4ed6-8236-1ad2d8e7ecea?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/88a0589d-95b8-4ed6-8236-1ad2d8e7ecea?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/88a0589d-95b8-4ed6-8236-1ad2d8e7ecea?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/88a0589d-95b8-4ed6-8236-1ad2d8e7ecea?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/88a0589d-95b8-4ed6-8236-1ad2d8e7ecea?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/88a0589d-95b8-4ed6-8236-1ad2d8e7ecea?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/22005)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#15162