Run failed: Invalid iterator value in Iteration block when processing sys.files #7437

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

Originally created by @mrnmkmn on GitHub (Dec 28, 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.14.2

Cloud or Self Hosted

Cloud

Steps to reproduce

  1. Create a workflow in Dify Studio with an “Iteration” block configured to process an array of files (sys.files).
  2. Set the input variable of the Iteration block as sys.files with the type Array[File].
  3. Run the workflow with an array containing files of various types (e.g., images, documents).
  4. Observe the error message:
    Run failed: invalid iterator value: value_type=<SegmentType.ARRAY_FILE: 'array[file]'> ...

スクリーンショット 2024-12-28 23 37 07

スクリーンショット 2024-12-28 23 36 29

✔️ Expected Behavior

The Iteration block should process each file in the sys.files array without errors and execute the defined steps in the iteration for each file.

Actual Behavior

The workflow fails with the following error message:

Run failed: invalid iterator value: value_type=<SegmentType.ARRAY_FILE:
'array[file]> value=
[File(dify_model_identity='.
-dify__file
id=None, tenant_id='eefcfd1a-d02f-4671-
b1f0-8b5a4fd194d2', type=
‹FileType.IMAGE: 'image'>, transfer_method= «FileTransferMethod.LOCAL_FILE:
'local _file'», remote_url=", related _id='c362a7f1-9262-460e-897c-1967d4012be4', filename=251-7a
2024-12-28 14.53.35.jpg', extension='.jpg', mime_type='image/jpeg', size=29103)] id='b7c280ac-a0b4-46fa-9d3d-
15faa944fb2d' name='files' description=" selector=('sys', 'files'), please provide a list.

Originally created by @mrnmkmn on GitHub (Dec 28, 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.14.2 ### Cloud or Self Hosted Cloud ### Steps to reproduce 1. Create a workflow in Dify Studio with an “Iteration” block configured to process an array of files (sys.files). 2. Set the input variable of the Iteration block as sys.files with the type Array[File]. 3. Run the workflow with an array containing files of various types (e.g., images, documents). 4. Observe the error message: Run failed: invalid iterator value: value_type=<SegmentType.ARRAY_FILE: 'array[file]'> ... ![スクリーンショット 2024-12-28 23 37 07](https://github.com/user-attachments/assets/cc1d9b0c-784b-444d-afe4-92eba0d2f529) ![スクリーンショット 2024-12-28 23 36 29](https://github.com/user-attachments/assets/5a2c7f7a-4a3e-483c-ad34-be59d57c515c) ### ✔️ Expected Behavior The Iteration block should process each file in the sys.files array without errors and execute the defined steps in the iteration for each file. ### ❌ Actual Behavior The workflow fails with the following error message: > Run failed: invalid iterator value: value_type=<SegmentType.ARRAY_FILE: > 'array[file]> value= > [File(dify_model_identity='. > -_dify__file_ > id=None, tenant_id='eefcfd1a-d02f-4671- > b1f0-8b5a4fd194d2', type= > ‹FileType.IMAGE: 'image'>, transfer_method= «FileTransferMethod.LOCAL_FILE: > 'local _file'», remote_url=", related _id='c362a7f1-9262-460e-897c-1967d4012be4', filename=251-7a > 2024-12-28 14.53.35.jpg', extension='.jpg', mime_type='image/jpeg', size=29103)] id='b7c280ac-a0b4-46fa-9d3d- > 15faa944fb2d' name='files' description=" selector=('sys', 'files'), please provide a list.
yindo added the 🐞 bug label 2026-02-21 18:20:34 -05:00
yindo closed this issue 2026-02-21 18:20:34 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 28, 2024):

Hey @mrnmkmn, I'm here to help you with your bug report and answer any questions you have. Let's work together to solve the issue you're experiencing.

To resolve the "Run failed: Invalid iterator value in Iteration block when processing sys.files" error in Dify version 0.14.2, you should update your Dify installation to a version that includes the fix from PR #12035. This fix modifies the ArrayFileVariable to properly inherit from ArrayVariable, allowing array files to be used correctly in iteration nodes.

If updating is not immediately possible, you can manually modify the file /app/api/core/variables/variables.py in your Docker container by changing:

class ArrayFileVariable(ArrayFileSegment, Variable)

to:

class ArrayFileVariable(ArrayFileSegment, ArrayVariable)

After making this change, restart your Docker compose setup. This modification allows the file list field to properly work with iteration nodes in the workflow [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Dec 28, 2024): <!-- Greeting --> Hey @mrnmkmn, I'm here to help you with your bug report and answer any questions you have. Let's work together to solve the issue you're experiencing. <!-- Answer --> To resolve the "Run failed: Invalid iterator value in Iteration block when processing sys.files" error in Dify version 0.14.2, you should update your Dify installation to a version that includes the fix from PR #12035. This fix modifies the `ArrayFileVariable` to properly inherit from `ArrayVariable`, allowing array files to be used correctly in iteration nodes. If updating is not immediately possible, you can manually modify the file `/app/api/core/variables/variables.py` in your Docker container by changing: ```python class ArrayFileVariable(ArrayFileSegment, Variable) ``` to: ```python class ArrayFileVariable(ArrayFileSegment, ArrayVariable) ``` After making this change, restart your Docker compose setup. This modification allows the file list field to properly work with iteration nodes in the workflow <sup>[[1]](https://github.com/langgenius/dify/issues/12048)</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/276e2a9f-3d18-4cb9-9d2e-d465205b4c2e?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/276e2a9f-3d18-4cb9-9d2e-d465205b4c2e?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/276e2a9f-3d18-4cb9-9d2e-d465205b4c2e?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/276e2a9f-3d18-4cb9-9d2e-d465205b4c2e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/276e2a9f-3d18-4cb9-9d2e-d465205b4c2e?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/276e2a9f-3d18-4cb9-9d2e-d465205b4c2e?feedback_type=other)</sup>
Author
Owner

@mrnmkmn commented on GitHub (Dec 28, 2024):

Thank you for the support.
Since I am using the cloud version of Dify, I will wait for the next update.

Closing this issue for now.
Thanks again!

@mrnmkmn commented on GitHub (Dec 28, 2024): Thank you for the support. Since I am using the cloud version of Dify, I will wait for the next update. Closing this issue for now. Thanks again!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7437