dify icon indicating copy to clipboard operation
dify copied to clipboard

Cannot add Variable Assigner inside Loop node

Open cufeo opened this issue 8 months ago • 3 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.1.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Create a Chatflow
  2. Create a loop node
  3. Try to add Variable Assigner

✔️ Expected Behavior

A Variable Assigner inside loop node

❌ Actual Behavior

Image

cufeo avatar Apr 01 '25 15:04 cufeo

Hey @cufeo! 👋 I'm here to help you with any bugs, questions, or contribution tips while we wait for a human maintainer. Let's squash those bugs together!

The error you're encountering, "Uncaught TypeError: Cannot add property _isShowTips, object is not extensible," suggests that the code is trying to add a new property to an object that has been made non-extensible. This issue occurs in the use-nodes-interactions.ts file, where the code attempts to set iterNodeData._isShowTips = true. The object iterNodeData is derived from parentNode.data and is likely non-extensible due to methods like Object.preventExtensions(), Object.seal(), or Object.freeze() being applied to it [1].

Currently, there are no documented workarounds or solutions specifically for this issue when adding a Variable Assigner inside a Loop node. You might want to check if there are any updates or patches available for your version of Dify that address this problem.

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 Apr 01 '25 15:04 dosubot[bot]

@dosu how to fix it, what file to modify?

cufeo avatar Apr 01 '25 15:04 cufeo

To address the issue of adding a Variable Assigner inside a Loop node, you should focus on the use-nodes-interactions.ts file. The error suggests that the object iterNodeData is non-extensible, which prevents adding new properties like _isShowTips.

Here are some steps you can take to fix this:

  1. Check for Non-Extensibility: Look for any code in use-nodes-interactions.ts that might be making iterNodeData non-extensible. This could be due to methods like Object.preventExtensions(), Object.seal(), or Object.freeze(). If you find such code, consider whether it's necessary or if it can be modified to allow extensions.

  2. Modify Object Creation: If iterNodeData is derived from parentNode.data, ensure that when creating or copying this object, it is not being made non-extensible. You might need to adjust how the object is initialized or copied.

  3. Test Changes: After making changes, test the workflow to ensure that the Variable Assigner can be added inside a Loop node without errors.

These steps should help you modify the necessary parts of the code to resolve the issue. If you need further assistance with specific code snippets, feel free to ask!

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 Apr 01 '25 15:04 dosubot[bot]

I can't add any node after if/else node in iteration node

JackMa-clareai avatar Jun 05 '25 07:06 JackMa-clareai