In the old process, an optional variable input was added, and using this variable for branch judgment caused an error in the previous session. #8264

Closed
opened 2026-02-21 18:24:46 -05:00 by yindo · 2 comments
Owner

Originally created by @abnormalboy on GitHub (Feb 14, 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.15.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Once I don't set a variable in the first place, I have no chance to set it again, because the old session will malfunction.
I will demonstrate my example below, I want to add the feature of switching models to my workflow:

  1. My old business:
    Image
    2.My new business:
Image

3.Old session error:

Image

I think adjusting inputs to dynamic will solve everything

✔️ Expected Behavior

Old sessions don't go wrong

Actual Behavior

The old session went wrong.

Originally created by @abnormalboy on GitHub (Feb 14, 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.15.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Once I don't set a variable in the first place, I have no chance to set it again, because the old session will malfunction. I will demonstrate my example below, I want to add the feature of switching models to my workflow: 1. My old business: <img width="707" alt="Image" src="https://github.com/user-attachments/assets/82cb2016-8409-4d3a-a2b3-15634a43113f" /> 2.My new business: <img width="882" alt="Image" src="https://github.com/user-attachments/assets/c415c182-9250-43fe-9b9c-4e428b46877d" /> 3.Old session error: <img width="553" alt="Image" src="https://github.com/user-attachments/assets/207e8ded-c575-4039-bb80-83b4a41170f5" /> I think adjusting `inputs` to dynamic will solve everything ### ✔️ Expected Behavior Old sessions don't go wrong ### ❌ Actual Behavior The old session went wrong.
yindo added the 🐞 bug🌊 feat:workflow labels 2026-02-21 18:24:46 -05:00
yindo closed this issue 2026-02-21 18:24:46 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 14, 2025):

Hey there, @abnormalboy! 👋 I'm here to help you out with any bugs, questions, or contributions you have in mind. I'm Dosu, a bot designed to assist you while you wait for a human maintainer. Let's squash those bugs together!

I found some similar discussions that might be relevant to your issue:

  1. The inputs of the conversation cannot be modified after the conversation is created? - This discussion is still open and might provide insights into handling input modifications in existing sessions [1].

  2. Error in item: Invalid variable. - This is another open discussion that deals with errors related to variables, which might be similar to the issue you're facing [2].

  3. Based on historical conversations, I want to re-transmit the inputs field - This discussion is also open and discusses re-transmitting input fields based on historical data, which could be relevant to your situation [3].

To address your issue of dynamic inputs to prevent errors in old sessions, you can ensure that the inputs are updated with default values or conditions that handle the absence of certain variables. This can be achieved by checking if the configuration is ready and then setting the query_variable_selector conditionally. Here's an example of how you might implement this:

useEffect(() => {
  const isReady = defaultConfig && Object.keys(defaultConfig).length > 0;
  if (isReady) {
    let query_variable_selector: ValueSelector = [];
    if (isChatMode && inputs.query_variable_selector.length === 0 && startNodeId)
      query_variable_selector = [startNodeId, 'sys.query'];
    setInputs({
      ...inputs,
      ...defaultConfig,
      query_variable_selector: inputs.query_variable_selector.length > 0 ? inputs.query_variable_selector : query_variable_selector,
    });
  }
}, [defaultConfig]);

This approach helps in making the inputs dynamic and prevents errors in old sessions by providing fallback values [4][5].

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] commented on GitHub (Feb 14, 2025): <!-- Greeting --> Hey there, @abnormalboy! 👋 I'm here to help you out with any bugs, questions, or contributions you have in mind. I'm Dosu, a bot designed to assist you while you wait for a human maintainer. Let's squash those bugs together! <!-- Answer --> I found some similar discussions that might be relevant to your issue: 1. [The inputs of the conversation cannot be modified after the conversation is created?](https://github.com/langgenius/dify/discussions/12259) - This discussion is still open and might provide insights into handling input modifications in existing sessions <sup>[[1]](https://github.com/langgenius/dify/discussions/12259)</sup>. 2. [Error in item: Invalid variable.](https://github.com/langgenius/dify/discussions/8611) - This is another open discussion that deals with errors related to variables, which might be similar to the issue you're facing <sup>[[2]](https://github.com/langgenius/dify/discussions/8611)</sup>. 3. [Based on historical conversations, I want to re-transmit the inputs field](https://github.com/langgenius/dify/discussions/4765) - This discussion is also open and discusses re-transmitting input fields based on historical data, which could be relevant to your situation <sup>[[3]](https://github.com/langgenius/dify/discussions/4765)</sup>. To address your issue of dynamic inputs to prevent errors in old sessions, you can ensure that the `inputs` are updated with default values or conditions that handle the absence of certain variables. This can be achieved by checking if the configuration is ready and then setting the `query_variable_selector` conditionally. Here's an example of how you might implement this: ```ts useEffect(() => { const isReady = defaultConfig && Object.keys(defaultConfig).length > 0; if (isReady) { let query_variable_selector: ValueSelector = []; if (isChatMode && inputs.query_variable_selector.length === 0 && startNodeId) query_variable_selector = [startNodeId, 'sys.query']; setInputs({ ...inputs, ...defaultConfig, query_variable_selector: inputs.query_variable_selector.length > 0 ? inputs.query_variable_selector : query_variable_selector, }); } }, [defaultConfig]); ``` This approach helps in making the `inputs` dynamic and prevents errors in old sessions by providing fallback values <sup>[[4]](https://github.com/langgenius/dify/blob/main/web/app/components/workflow/nodes/question-classifier/use-config.ts)</sup><sup>[[5]](https://github.com/langgenius/dify/blob/main/web/app/components/workflow/nodes/llm/use-config.ts)</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/fde20b5e-1cbd-4482-af72-038cc72aa8be?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/fde20b5e-1cbd-4482-af72-038cc72aa8be?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/fde20b5e-1cbd-4482-af72-038cc72aa8be?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/fde20b5e-1cbd-4482-af72-038cc72aa8be?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/fde20b5e-1cbd-4482-af72-038cc72aa8be?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/fde20b5e-1cbd-4482-af72-038cc72aa8be?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/fde20b5e-1cbd-4482-af72-038cc72aa8be?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Feb 14, 2025):

The new configuration only applies for the new conversation.

So the error encountered is an expected behavior.

Image

This has been resolved in below pr.
Ensure the 'inputs' field in /chat-messages takes effect every time (#7955)

@crazywoola commented on GitHub (Feb 14, 2025): The new configuration only applies for the new conversation. So the error encountered is an expected behavior. <img width="503" alt="Image" src="https://github.com/user-attachments/assets/94924cd9-c5ce-4ffd-9b85-42f1d7675254" /> This has been resolved in below pr. Ensure the 'inputs' field in /chat-messages takes effect every time (#7955)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8264