Variable aggregator cannot aggregate array[object] type data #13155

Closed
opened 2026-02-21 19:10:48 -05:00 by yindo · 2 comments
Owner

Originally created by @time1023 on GitHub (Apr 20, 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

1.2.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image

app:
description: ''
icon: 🤖
icon_background: '#FFEAD5'
mode: advanced-chat
name: 并行分支+变量聚合器
use_icon_as_answer_icon: false
dependencies: []
kind: app
version: 0.1.5
workflow:
conversation_variables: []
environment_variables: []
features:
file_upload:
allowed_file_extensions:
- .JPG
- .JPEG
- .PNG
- .GIF
- .WEBP
- .SVG
allowed_file_types:
- image
allowed_file_upload_methods:
- local_file
- remote_url
enabled: false
fileUploadConfig:
audio_file_size_limit: 50
batch_count_limit: 5
file_size_limit: 15
image_file_size_limit: 10
video_file_size_limit: 100
workflow_file_upload_limit: 10
image:
enabled: false
number_limits: 3
transfer_methods:
- local_file
- remote_url
number_limits: 3
opening_statement: ''
retriever_resource:
enabled: true
sensitive_word_avoidance:
enabled: false
speech_to_text:
enabled: false
suggested_questions: []
suggested_questions_after_answer:
enabled: false
text_to_speech:
enabled: false
language: ''
voice: ''
graph:
edges:
- data:
isInIteration: false
isInLoop: false
sourceType: start
targetType: code
id: 1745204249393-source-1745204262842-target
selected: false
source: '1745204249393'
sourceHandle: source
target: '1745204262842'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
sourceType: start
targetType: code
id: 1745204249393-source-1745204268707-target
source: '1745204249393'
sourceHandle: source
target: '1745204268707'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
sourceType: code
targetType: variable-aggregator
id: 1745204262842-source-1745204343302-target
source: '1745204262842'
sourceHandle: source
target: '1745204343302'
targetHandle: target
type: custom
zIndex: 0
- data:
isInLoop: false
sourceType: code
targetType: variable-aggregator
id: 1745204268707-source-1745204343302-target
source: '1745204268707'
sourceHandle: source
target: '1745204343302'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
sourceType: variable-aggregator
targetType: code
id: 1745204343302-source-1745204513251-target
source: '1745204343302'
sourceHandle: source
target: '1745204513251'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
sourceType: code
targetType: answer
id: 1745204513251-source-1745204489782-target
source: '1745204513251'
sourceHandle: source
target: '1745204489782'
targetHandle: target
type: custom
zIndex: 0
nodes:
- data:
desc: ''
selected: false
title: 开始
type: start
variables: []
height: 53
id: '1745204249393'
position:
x: -185.9553606529378
y: 271
positionAbsolute:
x: -185.9553606529378
y: 271
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
code: "\nfunction main() {\n return {\n result: [{name: '张三', age:
\ 18}]\n }\n}\n"
code_language: javascript
desc: ''
outputs:
result:
children: null
type: array[object]
selected: false
title: 代码执行1
type: code
variables: []
height: 53
id: '1745204262842'
position:
x: 217.24428803043952
y: 181.4439367138168
positionAbsolute:
x: 217.24428803043952
y: 181.4439367138168
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
code: "\nfunction main() {\n return {\n result: [{name: '李四', age:
\ 38}]\n }\n}\n"
code_language: javascript
desc: ''
outputs:
result:
children: null
type: array[object]
selected: true
title: 代码执行 2
type: code
variables: []
height: 53
id: '1745204268707'
position:
x: 211.41019310116474
y: 370.3609841784542
positionAbsolute:
x: 211.41019310116474
y: 370.3609841784542
selected: true
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
desc: ''
output_type: array[object]
selected: false
title: 变量聚合器
type: variable-aggregator
variables:
- - '1745204268707'
- result
- - '1745204262842'
- result
height: 130
id: '1745204343302'
position:
x: 592.3272405658022
y: 271
positionAbsolute:
x: 592.3272405658022
y: 271
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
answer: '{{#1745204513251.result#}}'
desc: ''
selected: false
title: 直接回复
type: answer
variables: []
height: 104
id: '1745204489782'
position:
x: 1286.4101931011649
y: 271
positionAbsolute:
x: 1286.4101931011649
y: 271
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
code: "\nfunction main({arg1}) {\n return {\n result: JSON.stringify(arg1)\n
\ }\n}\n"
code_language: javascript
desc: ''
outputs:
result:
children: null
type: string
selected: false
title: 代码执行 3
type: code
variables:
- value_selector:
- '1745204343302'
- output
variable: arg1
height: 53
id: '1745204513251'
position:
x: 950.7834795102965
y: 271
positionAbsolute:
x: 950.7834795102965
y: 271
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
viewport:
x: 269.102586179687
y: 115.4414677298679
zoom: 0.49999999999999994

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @time1023 on GitHub (Apr 20, 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 1.2.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ![Image](https://github.com/user-attachments/assets/67c3d00e-a0c2-476d-a370-0d87723a0e9f) app: description: '' icon: 🤖 icon_background: '#FFEAD5' mode: advanced-chat name: 并行分支+变量聚合器 use_icon_as_answer_icon: false dependencies: [] kind: app version: 0.1.5 workflow: conversation_variables: [] environment_variables: [] features: file_upload: allowed_file_extensions: - .JPG - .JPEG - .PNG - .GIF - .WEBP - .SVG allowed_file_types: - image allowed_file_upload_methods: - local_file - remote_url enabled: false fileUploadConfig: audio_file_size_limit: 50 batch_count_limit: 5 file_size_limit: 15 image_file_size_limit: 10 video_file_size_limit: 100 workflow_file_upload_limit: 10 image: enabled: false number_limits: 3 transfer_methods: - local_file - remote_url number_limits: 3 opening_statement: '' retriever_resource: enabled: true sensitive_word_avoidance: enabled: false speech_to_text: enabled: false suggested_questions: [] suggested_questions_after_answer: enabled: false text_to_speech: enabled: false language: '' voice: '' graph: edges: - data: isInIteration: false isInLoop: false sourceType: start targetType: code id: 1745204249393-source-1745204262842-target selected: false source: '1745204249393' sourceHandle: source target: '1745204262842' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false isInLoop: false sourceType: start targetType: code id: 1745204249393-source-1745204268707-target source: '1745204249393' sourceHandle: source target: '1745204268707' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false isInLoop: false sourceType: code targetType: variable-aggregator id: 1745204262842-source-1745204343302-target source: '1745204262842' sourceHandle: source target: '1745204343302' targetHandle: target type: custom zIndex: 0 - data: isInLoop: false sourceType: code targetType: variable-aggregator id: 1745204268707-source-1745204343302-target source: '1745204268707' sourceHandle: source target: '1745204343302' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false isInLoop: false sourceType: variable-aggregator targetType: code id: 1745204343302-source-1745204513251-target source: '1745204343302' sourceHandle: source target: '1745204513251' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false isInLoop: false sourceType: code targetType: answer id: 1745204513251-source-1745204489782-target source: '1745204513251' sourceHandle: source target: '1745204489782' targetHandle: target type: custom zIndex: 0 nodes: - data: desc: '' selected: false title: 开始 type: start variables: [] height: 53 id: '1745204249393' position: x: -185.9553606529378 y: 271 positionAbsolute: x: -185.9553606529378 y: 271 selected: false sourcePosition: right targetPosition: left type: custom width: 244 - data: code: "\nfunction main() {\n return {\n result: [{name: '张三', age:\ \ 18}]\n }\n}\n" code_language: javascript desc: '' outputs: result: children: null type: array[object] selected: false title: 代码执行1 type: code variables: [] height: 53 id: '1745204262842' position: x: 217.24428803043952 y: 181.4439367138168 positionAbsolute: x: 217.24428803043952 y: 181.4439367138168 selected: false sourcePosition: right targetPosition: left type: custom width: 244 - data: code: "\nfunction main() {\n return {\n result: [{name: '李四', age:\ \ 38}]\n }\n}\n" code_language: javascript desc: '' outputs: result: children: null type: array[object] selected: true title: 代码执行 2 type: code variables: [] height: 53 id: '1745204268707' position: x: 211.41019310116474 y: 370.3609841784542 positionAbsolute: x: 211.41019310116474 y: 370.3609841784542 selected: true sourcePosition: right targetPosition: left type: custom width: 244 - data: desc: '' output_type: array[object] selected: false title: 变量聚合器 type: variable-aggregator variables: - - '1745204268707' - result - - '1745204262842' - result height: 130 id: '1745204343302' position: x: 592.3272405658022 y: 271 positionAbsolute: x: 592.3272405658022 y: 271 selected: false sourcePosition: right targetPosition: left type: custom width: 244 - data: answer: '{{#1745204513251.result#}}' desc: '' selected: false title: 直接回复 type: answer variables: [] height: 104 id: '1745204489782' position: x: 1286.4101931011649 y: 271 positionAbsolute: x: 1286.4101931011649 y: 271 selected: false sourcePosition: right targetPosition: left type: custom width: 244 - data: code: "\nfunction main({arg1}) {\n return {\n result: JSON.stringify(arg1)\n\ \ }\n}\n" code_language: javascript desc: '' outputs: result: children: null type: string selected: false title: 代码执行 3 type: code variables: - value_selector: - '1745204343302' - output variable: arg1 height: 53 id: '1745204513251' position: x: 950.7834795102965 y: 271 positionAbsolute: x: 950.7834795102965 y: 271 selected: false sourcePosition: right targetPosition: left type: custom width: 244 viewport: x: 269.102586179687 y: 115.4414677298679 zoom: 0.49999999999999994 ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo closed this issue 2026-02-21 19:10:48 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 20, 2025):

The variable aggregator in Dify is designed to handle array[object] type data by ensuring that the data is a list and each element is a dictionary (object). If the data does not meet these criteria, it raises an OutputValidationError. Additionally, the length of the list must not exceed the maximum allowed length defined by dify_config.CODE_MAX_OBJECT_ARRAY_LENGTH [1].

In your case, it seems like the variable aggregator is not aggregating the array[object] type data as expected. Ensure that the outputs from the code execution nodes are correctly formatted as lists of objects and that they do not exceed the maximum length. If the issue persists, verify that the configuration settings are correctly applied and consider checking for any updates or patches that might address this behavior.

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 (Apr 20, 2025): <!-- Answer --> The variable aggregator in Dify is designed to handle `array[object]` type data by ensuring that the data is a list and each element is a dictionary (object). If the data does not meet these criteria, it raises an `OutputValidationError`. Additionally, the length of the list must not exceed the maximum allowed length defined by `dify_config.CODE_MAX_OBJECT_ARRAY_LENGTH` <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/workflow/nodes/code/code_node.py)</sup>. In your case, it seems like the variable aggregator is not aggregating the `array[object]` type data as expected. Ensure that the outputs from the code execution nodes are correctly formatted as lists of objects and that they do not exceed the maximum length. If the issue persists, verify that the configuration settings are correctly applied and consider checking for any updates or patches that might address this behavior. <!-- 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/d48048ce-f819-4f3a-9223-d62bc6a149a4?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/d48048ce-f819-4f3a-9223-d62bc6a149a4?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/d48048ce-f819-4f3a-9223-d62bc6a149a4?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/d48048ce-f819-4f3a-9223-d62bc6a149a4?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/d48048ce-f819-4f3a-9223-d62bc6a149a4?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/d48048ce-f819-4f3a-9223-d62bc6a149a4?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/d48048ce-f819-4f3a-9223-d62bc6a149a4?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Apr 20, 2025):

https://docs.dify.ai/guides/workflow/node/variable-aggregator

See the docs

Aggregate variables from multiple branches into a single variable to achieve unified configuration for downstream nodes.

The variable aggregation node (formerly the variable assignment node) is a key node in the workflow. It is responsible for integrating the output results from different branches, ensuring that regardless of which branch is executed, its results can be referenced and accessed through a unified variable. This is particularly useful in multi-branch scenarios, as it maps variables with the same function from different branches into a single output variable, avoiding the need for repeated definitions in downstream nodes.

TL:DR

It doesn't aggregate the results, instead, it aggregates the variables across multiple branches, if you want to aggregate the results, you can use template or code to do it.

@crazywoola commented on GitHub (Apr 20, 2025): https://docs.dify.ai/guides/workflow/node/variable-aggregator See the docs > Aggregate variables from multiple branches into a single variable to achieve unified configuration for downstream nodes. > > The variable aggregation node (formerly the variable assignment node) is a key node in the workflow. It is responsible for integrating the output results from different branches, ensuring that regardless of which branch is executed, its results can be referenced and accessed through a unified variable. This is particularly useful in multi-branch scenarios, as it maps variables with the same function from different branches into a single output variable, avoiding the need for repeated definitions in downstream nodes. TL:DR It doesn't aggregate the results, instead, it aggregates the variables across multiple branches, if you want to aggregate the results, you can use template or code to do it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13155