Variable key and answer-placeholder error when testing iteration #6040

Closed
opened 2026-02-21 18:13:48 -05:00 by yindo · 5 comments
Owner

Originally created by @HeMuling on GitHub (Oct 11, 2024).

Originally assigned to: @iamjoel on GitHub.

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.1-fix1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  • Create any random iteration
  • Test iteration

✔️ Expected Behavior

The workflow correctly works

Actual Behavior

Variable key 1728671307136.1728671307136.#files# not found in user inputs.

However, if test the whole workflow, the iteration works correctly. If something wrong happens during the running of the whole workflow, and you rerun without clear previous message, then it shows answer-placeholder-1728677768034 is not a valid uuid.

If you rerun the whole workflow after the first run is success, then nothing wrong happens.

Originally created by @HeMuling on GitHub (Oct 11, 2024). Originally assigned to: @iamjoel on GitHub. ### 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.1-fix1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce - Create any random iteration - Test iteration ### ✔️ Expected Behavior The workflow correctly works ### ❌ Actual Behavior `Variable key 1728671307136.1728671307136.#files# not found in user inputs.` However, if test the whole workflow, the iteration works correctly. If something wrong happens during the running of the whole workflow, and you rerun without clear previous message, then it shows `answer-placeholder-1728677768034 is not a valid uuid.` If you rerun the whole workflow after the first run is success, then nothing wrong happens.
yindo added the 🐞 bug label 2026-02-21 18:13:48 -05:00
yindo closed this issue 2026-02-21 18:13:48 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 11, 2024):

@HeMuling Hello there! I'm a bot designed to help you with bug fixes, answer your questions, and guide you on becoming a contributor. I'm here to assist you while waiting for a human maintainer.

I found a similar unsolved discussion regarding the "Invalid variable" error. You can check it out here [1].

Regarding your issue, the "Variable key not found" error occurs because the variable key is missing in the user_inputs of the VariablePool. This happens when the variable isn't explicitly added to the pool [2].

The "answer-placeholder is not a valid uuid" error likely arises from placeholders not being replaced with valid UUIDs. This can occur if the system reuses placeholders without generating new UUIDs, especially if previous states aren't cleared properly [2].

To address these issues, ensure that the VariablePool is correctly initialized with all necessary variables and that the state is properly reset between runs. The handleRestart function should help reset the conversation state by clearing identifiers and stopping ongoing processes [3].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 11, 2024): <!-- Greeting --> @HeMuling Hello there! I'm a bot designed to help you with bug fixes, answer your questions, and guide you on becoming a contributor. I'm here to assist you while waiting for a human maintainer. <!-- Answer --> I found a similar unsolved discussion regarding the "Invalid variable" error. You can check it out [here](https://github.com/langgenius/dify/discussions/8611) <sup>[[1]](https://github.com/langgenius/dify/discussions/8611)</sup>. Regarding your issue, the "Variable key not found" error occurs because the variable key is missing in the `user_inputs` of the `VariablePool`. This happens when the variable isn't explicitly added to the pool <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/tests/unit_tests/core/workflow/nodes/iteration/test_iteration.py)</sup>. The "answer-placeholder is not a valid uuid" error likely arises from placeholders not being replaced with valid UUIDs. This can occur if the system reuses placeholders without generating new UUIDs, especially if previous states aren't cleared properly <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/tests/unit_tests/core/workflow/nodes/iteration/test_iteration.py)</sup>. To address these issues, ensure that the `VariablePool` is correctly initialized with all necessary variables and that the state is properly reset between runs. The `handleRestart` function should help reset the conversation state by clearing identifiers and stopping ongoing processes <sup>[[3]](https://github.com/langgenius/dify/blob/main/web/app/components/workflow/panel/debug-and-preview/hooks.ts)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@HeMuling commented on GitHub (Oct 11, 2024):

To reproduce, try to import: this workflow, and test:

  1. first try to test iteration, which raise error as I mentioned above
  2. second try to run the entire workflow, before the workflow finishes, stop and run with new prompt (or same, shouldn't matter), it will also raise error as I mentioned above
    I've test both on my mac's docker and the official cloud version
@HeMuling commented on GitHub (Oct 11, 2024): To reproduce, try to import: [this workflow](https://raw.githubusercontent.com/svcvit/Awesome-Dify-Workflow/refs/heads/main/DSL/llm2o1.cn.yml), and test: 1. first try to test iteration, which raise error as I mentioned above 2. second try to run the entire workflow, before the workflow finishes, stop and run with new prompt (or same, shouldn't matter), it will also raise error as I mentioned above I've test both on my mac's docker and the official cloud version
Author
Owner

@dajianguo commented on GitHub (Oct 14, 2024):

Yes,It is a bug, i have resovle it.

@dajianguo commented on GitHub (Oct 14, 2024): Yes,It is a bug, i have resovle it.
Author
Owner

@dajianguo commented on GitHub (Oct 14, 2024):

222
111
You can modify these two places

@dajianguo commented on GitHub (Oct 14, 2024): ![222](https://github.com/user-attachments/assets/152143b5-b3c7-4a3a-b937-c015983911ae) ![111](https://github.com/user-attachments/assets/ca8a6087-2281-4b00-a4c8-672954fc71e7) You can modify these two places
Author
Owner

@iamjoel commented on GitHub (Oct 25, 2024):

Fixed by https://github.com/langgenius/dify/pull/9835

@iamjoel commented on GitHub (Oct 25, 2024): Fixed by https://github.com/langgenius/dify/pull/9835
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6040