0.8.0 also raise error validation error for VariableAssignerNodeData #5783

Closed
opened 2026-02-21 18:12:34 -05:00 by yindo · 3 comments
Owner

Originally created by @yuhp-zts on GitHub (Sep 24, 2024).

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.8.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Iteration node in chatflow:an error occurs.
{
"iterator_selector": [
{
"company": "company 1",
"tools": {
"tool1": "tool 1",
"tool2": "tool 2"
}
},
{
"company": "company 2",
"tools": {
"tool2": "tool2"
}
}
]
}

image

image

2024-09-25 01:42:10,831.831 ERROR [Thread-96 (_generate_worker)] [graph_engine.py:184] - Unknown Error when graph running
Traceback (most recent call last):
File "/app/api/core/workflow/graph_engine/graph_engine.py", line 145, in run
for item in generator:
File "/app/api/core/workflow/nodes/answer/answer_stream_processor.py", line 30, in process
for event in generator:
File "/app/api/core/workflow/graph_engine/graph_engine.py", line 233, in _run
node_instance = node_cls( # type: ignore
File "/app/api/core/workflow/nodes/base_node.py", line 48, in init
self.node_data = self._node_data_cls(**config.get("data", {}))
File "/app/api/.venv/lib/python3.10/site-packages/pydantic/main.py", line 193, in init
self.pydantic_validator.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for VariableAssignerNodeData
advanced_settings.groups.0.output_type
Input should be 'string', 'number', 'object', 'array[string]', 'array[number]' or 'array[object]' [type=literal_error, input_value='any', input_type=str]
For further information visit https://errors.pydantic.dev/2.8/v/literal_error

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @yuhp-zts on GitHub (Sep 24, 2024). ### 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.8.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Iteration node in chatflow:an error occurs. { "iterator_selector": [ { "company": "company 1", "tools": { "tool1": "tool 1", "tool2": "tool 2" } }, { "company": "company 2", "tools": { "tool2": "tool2" } } ] } ![image](https://github.com/user-attachments/assets/988c6d7f-1dac-4969-b4d9-04e42e8294ef) ![image](https://github.com/user-attachments/assets/92099364-b334-49c8-89b1-a7bca1baf12a) 2024-09-25 01:42:10,831.831 ERROR [Thread-96 (_generate_worker)] [graph_engine.py:184] - Unknown Error when graph running Traceback (most recent call last): File "/app/api/core/workflow/graph_engine/graph_engine.py", line 145, in run for item in generator: File "/app/api/core/workflow/nodes/answer/answer_stream_processor.py", line 30, in process for event in generator: File "/app/api/core/workflow/graph_engine/graph_engine.py", line 233, in _run node_instance = node_cls( # type: ignore File "/app/api/core/workflow/nodes/base_node.py", line 48, in __init__ self.node_data = self._node_data_cls(**config.get("data", {})) File "/app/api/.venv/lib/python3.10/site-packages/pydantic/main.py", line 193, in __init__ self.__pydantic_validator__.validate_python(data, self_instance=self) pydantic_core._pydantic_core.ValidationError: 1 validation error for VariableAssignerNodeData advanced_settings.groups.0.output_type Input should be 'string', 'number', 'object', 'array[string]', 'array[number]' or 'array[object]' [type=literal_error, input_value='any', input_type=str] For further information visit https://errors.pydantic.dev/2.8/v/literal_error ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:12:34 -05:00
yindo closed this issue 2026-02-21 18:12:34 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 24, 2024):

I found a similar unsolved discussion regarding an "Invalid variable" error in the Dify repository [1].

The validation error for VariableAssignerNodeData in version 0.8.0 occurs because the VariableAssignerNode class expects the node_data to be of type VariableAssignerData. If the node_data does not conform to this expected type, it will raise a validation error. The structure and type definition of VariableAssignerData are as follows:

class VariableAssignerData(BaseNodeData):
    title: str = "Variable Assigner"
    desc: Optional[str] = "Assign a value to a variable"
    assigned_variable_selector: Sequence[str]
    write_mode: WriteMode
    input_variable_selector: Sequence[str]

In the _run method of VariableAssignerNode, self.node_data is cast to VariableAssignerData. If self.node_data does not match the structure and type of VariableAssignerData, it will result in a validation error [2].

Additionally, ensure that the iterator_selector and output_selector in the IterationNode are correctly configured and validated. The iterator_selector should point to a valid list in the VariablePool, and the data being iterated over should match the expected types [3][4].

To avoid such issues, make sure that the conversation variables are correctly defined and used within the chatflow. Conversation variables allow application developers to specify particular information that needs to be temporarily stored within the same Chatflow session, ensuring that this information can be referenced across multiple rounds of chatting within the current chatflow [5].

If you need further assistance, please provide more details about the specific configuration and data being used in your chatflow.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Sep 24, 2024): <!-- Answer --> I found a similar unsolved discussion regarding an "Invalid variable" error in the Dify repository <sup>[[1]](https://github.com/langgenius/dify/discussions/8611)</sup>. The validation error for `VariableAssignerNodeData` in version 0.8.0 occurs because the `VariableAssignerNode` class expects the `node_data` to be of type `VariableAssignerData`. If the `node_data` does not conform to this expected type, it will raise a validation error. The structure and type definition of `VariableAssignerData` are as follows: ```python class VariableAssignerData(BaseNodeData): title: str = "Variable Assigner" desc: Optional[str] = "Assign a value to a variable" assigned_variable_selector: Sequence[str] write_mode: WriteMode input_variable_selector: Sequence[str] ``` In the `_run` method of `VariableAssignerNode`, `self.node_data` is cast to `VariableAssignerData`. If `self.node_data` does not match the structure and type of `VariableAssignerData`, it will result in a validation error <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/workflow/nodes/variable_assigner/node.py)</sup>. Additionally, ensure that the `iterator_selector` and `output_selector` in the `IterationNode` are correctly configured and validated. The `iterator_selector` should point to a valid list in the `VariablePool`, and the data being iterated over should match the expected types <sup>[[3]](https://github.com/langgenius/dify/blob/main/api/core/workflow/nodes/iteration/iteration_node.py)</sup><sup>[[4]](https://github.com/langgenius/dify/blob/main/api/tests/unit_tests/core/workflow/nodes/iteration/test_iteration.py)</sup>. To avoid such issues, make sure that the conversation variables are correctly defined and used within the chatflow. Conversation variables allow application developers to specify particular information that needs to be temporarily stored within the same Chatflow session, ensuring that this information can be referenced across multiple rounds of chatting within the current chatflow <sup>[[5]](https://github.com/langgenius/dify-docs/blob/main/en/guides/workflow/variables.md)</sup>. If you need further assistance, please provide more details about the specific configuration and data being used in your chatflow. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@yuhp-zts commented on GitHub (Sep 24, 2024):

When I export the workflow and reload it, the error is gone.

@yuhp-zts commented on GitHub (Sep 24, 2024): When I export the workflow and reload it, the error is gone.
Author
Owner

@reatang commented on GitHub (Mar 20, 2025):

1.1.0 Problems remain

Image
1 validation error for VariableAssignerNodeData advanced_settings.groups.0.output_type Input should be 'string', 'number', 'object', 'array[string]', 'array[number]' or 'array[object]' [type=literal_error, input_value='any', input_type=str] For further information visit https://errors.pydantic.dev/2.9/v/literal_error

but if add Group1, It fix

Image
@reatang commented on GitHub (Mar 20, 2025): 1.1.0 Problems remain <img width="1131" alt="Image" src="https://github.com/user-attachments/assets/e46d055d-67b5-4c2f-afa7-fdd4aef95bae" /> ``` 1 validation error for VariableAssignerNodeData advanced_settings.groups.0.output_type Input should be 'string', 'number', 'object', 'array[string]', 'array[number]' or 'array[object]' [type=literal_error, input_value='any', input_type=str] For further information visit https://errors.pydantic.dev/2.9/v/literal_error ``` but if add Group1, It fix <img width="944" alt="Image" src="https://github.com/user-attachments/assets/1f98765d-b845-479d-b37a-7f2513fde973" />
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5783