langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
53.71k stars 7.86k forks source link

+= feature in variable assigner prevents workflow from publishing #11327

Closed sugoh closed 9 hours ago

sugoh commented 11 hours ago

Self Checks

Dify version

v0.11.2

Cloud or Self Hosted

Cloud

Steps to reproduce

  1. Open a Dify workflow in Studio GUI
  2. Add a conversation variable with type Number and set the default value to 0
  3. Create a Variable Assigner block
  4. In (3), set the operation to +=
  5. Preview the workflow: the conversation variable will increment as expected
  6. Publish the workflow: you will now get an error saying [Variable Assigner] Variable is required
Screenshot 2024-12-04 at 2 25 09 PM Screenshot 2024-12-04 at 2 25 18 PM

✔️ Expected Behavior

Publish the workflow successfully

❌ Actual Behavior

Error saying [Variable Assigner] Variable is required

dosubot[bot] commented 11 hours ago

The issue you're encountering with the '+= feature' in the 'Variable Assigner' block during the publishing process seems to be related to the validation checks that are performed. The error message "[Variable Assigner] Variable is required" is triggered under specific conditions, such as when the variable_selector is not provided or its length is zero, or when the operation is not WriteMode.clear and the value is not provided or is not a number [1].

In your case, it seems that the workflow is not recognizing the variable correctly during the publishing process, even though it works as expected during the preview. This could be due to a validation check that fails when the workflow is being published.

To resolve this, ensure that all required fields in the 'Variable Assigner' block are correctly set and that the variable is properly defined and accessible. If the issue persists, it might be a bug in the current version of Dify (v0.11.2), and you may need to check for any updates or patches that address this issue.

To continue talking to Dosu, mention @dosu.