Iteration over Array of Files failed #18212

Closed
opened 2026-02-21 19:44:56 -05:00 by yindo · 0 comments
Owner

Originally created by @dfxbb on GitHub (Sep 25, 2025).

Originally assigned to: @Nov1c444 on GitHub.

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.9.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

After upgraded to 1.9.0, our workflow with iteration node and Array[File] input failed to execute.

Can be reproduced with a simple workflow as below:

Image Image

Error log from docker-api-1 container:

[2025-09-25 07:22:04 +0000] [72] [ERROR] Error handling request
Traceback (most recent call last):
  File "/app/api/.venv/lib/python3.12/site-packages/gunicorn/workers/base_async.py", line 114, in handle_request
    for item in respiter:
                ^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/werkzeug/wsgi.py", line 256, in __next__
    return self._next()
           ^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/werkzeug/wrappers/response.py", line 32, in _iter_encoded
    for item in iterable:
                ^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/flask/helpers.py", line 132, in generator
    yield from gen
  File "/app/api/libs/helper.py", line 207, in generate
    yield from response
  File "/app/api/core/app/features/rate_limiting/rate_limit.py", line 120, in __next__
    return next(self.generator)
           ^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/app/apps/base_app_generator.py", line 176, in gen
    for message in generator:
                   ^^^^^^^^^
  File "/app/api/core/app/apps/base_app_generate_response_converter.py", line 27, in _generate_full_response
    yield from cls.convert_stream_full_response(response)
  File "/app/api/core/app/apps/workflow/generate_response_converter.py", line 46, in convert_stream_full_response
    for chunk in stream_response:
                 ^^^^^^^^^^^^^^^
  File "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 190, in _to_stream_response
    for stream_response in generator:
                           ^^^^^^^^^
  File "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 221, in _wrapper_process_stream_response
    for response in self._process_stream_response(tts_publisher=tts_publisher, trace_manager=trace_manager):
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 686, in _process_stream_response
    if responses := list(
                    ^^^^^
  File "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 615, in _dispatch_event
    yield from handler(
  File "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 373, in _handle_iteration_start_event
    iter_start_resp = self._workflow_response_converter.workflow_iteration_start_to_stream_response(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/app/apps/common/workflow_response_converter.py", line 288, in workflow_iteration_start_to_stream_response
    new_inputs, truncated = self._truncator.truncate_variable_mapping(event.inputs or {})
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/services/variable_truncator.py", line 125, in truncate_variable_mapping
    part_result = self._truncate_json_primitives(value, value_budget)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/services/variable_truncator.py", line 388, in _truncate_json_primitives
    return self._truncate_array(val, target_size)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/services/variable_truncator.py", line 273, in _truncate_array
    part_result = self._truncate_json_primitives(item, target_size - used_size)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/services/variable_truncator.py", line 394, in _truncate_json_primitives
    raise AssertionError("this statement should be unreachable.")
AssertionError: this statement should be unreachable.

✔️ Expected Behavior

Workflow runs normally

Actual Behavior

Workflow stops before the iteration node

Originally created by @dfxbb on GitHub (Sep 25, 2025). Originally assigned to: @Nov1c444 on GitHub. ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.9.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce After upgraded to 1.9.0, our workflow with iteration node and Array[File] input failed to execute. Can be reproduced with a simple workflow as below: <img width="917" height="215" alt="Image" src="https://github.com/user-attachments/assets/3a091bd6-a8b2-4c2c-abbe-c1d884b62c56" /> <img width="938" height="587" alt="Image" src="https://github.com/user-attachments/assets/7c9a27dc-8158-48cf-a190-bc75f7d008aa" /> Error log from docker-api-1 container: ``` [2025-09-25 07:22:04 +0000] [72] [ERROR] Error handling request Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/gunicorn/workers/base_async.py", line 114, in handle_request for item in respiter: ^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/werkzeug/wsgi.py", line 256, in __next__ return self._next() ^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/werkzeug/wrappers/response.py", line 32, in _iter_encoded for item in iterable: ^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/helpers.py", line 132, in generator yield from gen File "/app/api/libs/helper.py", line 207, in generate yield from response File "/app/api/core/app/features/rate_limiting/rate_limit.py", line 120, in __next__ return next(self.generator) ^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/app/apps/base_app_generator.py", line 176, in gen for message in generator: ^^^^^^^^^ File "/app/api/core/app/apps/base_app_generate_response_converter.py", line 27, in _generate_full_response yield from cls.convert_stream_full_response(response) File "/app/api/core/app/apps/workflow/generate_response_converter.py", line 46, in convert_stream_full_response for chunk in stream_response: ^^^^^^^^^^^^^^^ File "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 190, in _to_stream_response for stream_response in generator: ^^^^^^^^^ File "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 221, in _wrapper_process_stream_response for response in self._process_stream_response(tts_publisher=tts_publisher, trace_manager=trace_manager): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 686, in _process_stream_response if responses := list( ^^^^^ File "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 615, in _dispatch_event yield from handler( File "/app/api/core/app/apps/workflow/generate_task_pipeline.py", line 373, in _handle_iteration_start_event iter_start_resp = self._workflow_response_converter.workflow_iteration_start_to_stream_response( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/app/apps/common/workflow_response_converter.py", line 288, in workflow_iteration_start_to_stream_response new_inputs, truncated = self._truncator.truncate_variable_mapping(event.inputs or {}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/services/variable_truncator.py", line 125, in truncate_variable_mapping part_result = self._truncate_json_primitives(value, value_budget) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/services/variable_truncator.py", line 388, in _truncate_json_primitives return self._truncate_array(val, target_size) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/services/variable_truncator.py", line 273, in _truncate_array part_result = self._truncate_json_primitives(item, target_size - used_size) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/services/variable_truncator.py", line 394, in _truncate_json_primitives raise AssertionError("this statement should be unreachable.") AssertionError: this statement should be unreachable. ``` ### ✔️ Expected Behavior Workflow runs normally ### ❌ Actual Behavior Workflow stops before the iteration node
yindo added the 🐞 bug label 2026-02-21 19:44:56 -05:00
yindo closed this issue 2026-02-21 19:44:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#18212