Issue with File List Field in Workflow Type Application after Upgrade to 0.14.2 #7376

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

Originally created by @xiandan-erizo on GitHub (Dec 24, 2024).

Originally assigned to: @laipz8200 on GitHub.

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

Self Hosted (Docker)

Steps to reproduce

I have encountered an error with the file list field in the workflow type application after upgrading to version 0.14.2. The error occurs at the iteration node and prevents the application from functioning correctly.

image
image

image

Error Message:

invalid iterator value: value_type=<SegmentType.ARRAY_FILE: 'array[file]'> value=[File(dify_model_identity='__dify__file__', id=None, tenant_id='62286568-a061-4bbb-838a-38fb6fb760cb', type=<FileType.IMAGE: 'image'>, transfer_method=<FileTransferMethod.LOCAL_FILE: 'local_file'>, remote_url='', related_id='d77100cb-1833-40f1-a657-91fa081f91fa', filename='1734066775771.png', extension='.png', mime_type='image/png', size=107605), File(dify_model_identity='__dify__file__', id=None, tenant_id='62286568-a061-4bbb-838a-38fb6fb760cb', type=<FileType.IMAGE: 'image'>, transfer_method=<FileTransferMethod.LOCAL_FILE: 'local_file'>, remote_url='', related_id='c07c7047-c34d-42f1-8504-24890f1e6fbb', filename='1111.jpg', extension='.jpg', mime_type='image/jpeg', size=266584)] id='3a0b5dd9-3cb4-40be-8d43-32ddec892f3c' name='attachments' description='' selector=['1734595526118', 'attachments'], please provide a list.

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @xiandan-erizo on GitHub (Dec 24, 2024). Originally assigned to: @laipz8200 on GitHub. ### 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 Self Hosted (Docker) ### Steps to reproduce I have encountered an error with the file list field in the workflow type application after upgrading to version 0.14.2. The error occurs at the iteration node and prevents the application from functioning correctly. ![image](https://github.com/user-attachments/assets/9bcbc02e-201c-446e-a927-965585a2425b) ![image](https://github.com/user-attachments/assets/81f16030-8737-44c4-9668-00d16786c84a) ![image](https://github.com/user-attachments/assets/0fc7f2f3-7bd2-4ebd-82e8-e47bc7e286aa) **Error Message:** ``` invalid iterator value: value_type=<SegmentType.ARRAY_FILE: 'array[file]'> value=[File(dify_model_identity='__dify__file__', id=None, tenant_id='62286568-a061-4bbb-838a-38fb6fb760cb', type=<FileType.IMAGE: 'image'>, transfer_method=<FileTransferMethod.LOCAL_FILE: 'local_file'>, remote_url='', related_id='d77100cb-1833-40f1-a657-91fa081f91fa', filename='1734066775771.png', extension='.png', mime_type='image/png', size=107605), File(dify_model_identity='__dify__file__', id=None, tenant_id='62286568-a061-4bbb-838a-38fb6fb760cb', type=<FileType.IMAGE: 'image'>, transfer_method=<FileTransferMethod.LOCAL_FILE: 'local_file'>, remote_url='', related_id='c07c7047-c34d-42f1-8504-24890f1e6fbb', filename='1111.jpg', extension='.jpg', mime_type='image/jpeg', size=266584)] id='3a0b5dd9-3cb4-40be-8d43-32ddec892f3c' name='attachments' description='' selector=['1734595526118', 'attachments'], please provide a list. ``` ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:20:16 -05:00
yindo closed this issue 2026-02-21 18:20:16 -05:00
Author
Owner

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

To resolve the issue with the file list field in your Dify workflow application after upgrading to version 0.14.2, ensure that the file variable in the start node is correctly set to an Array[File] type. This setup is crucial for handling multiple files without encountering iterator errors.

Here's a step-by-step guide to configure it properly:

  1. Set the File Variable: Ensure that the file variable in the start node is configured as an Array[File]. This means it should be a list of files, not a single file.

  2. Add a List Operation Node: After the start node, include a list operation node. This node will process each file in the list, allowing you to filter and extract attributes such as file format type, file name, and size.

  3. Process Files Appropriately: Use the list operation node to direct different file types to their corresponding processing nodes. This setup will help manage various file formats effectively.

This configuration ensures that the iteration node can handle each file in the list correctly, preventing iterator errors and allowing for precise control over different file processing flows [1][2][3].

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 24, 2024): <!-- Answer --> To resolve the issue with the file list field in your Dify workflow application after upgrading to version 0.14.2, ensure that the file variable in the start node is correctly set to an `Array[File]` type. This setup is crucial for handling multiple files without encountering iterator errors. Here's a step-by-step guide to configure it properly: 1. **Set the File Variable**: Ensure that the file variable in the start node is configured as an `Array[File]`. This means it should be a list of files, not a single file. 2. **Add a List Operation Node**: After the start node, include a list operation node. This node will process each file in the list, allowing you to filter and extract attributes such as file format type, file name, and size. 3. **Process Files Appropriately**: Use the list operation node to direct different file types to their corresponding processing nodes. This setup will help manage various file formats effectively. This configuration ensures that the iteration node can handle each file in the list correctly, preventing iterator errors and allowing for precise control over different file processing flows <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/jp/workshop/intermediate/article-reader.md)</sup><sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/en/guides/workflow/node/list-operator.md)</sup><sup>[[3]](https://github.com/langgenius/dify-docs/blob/main/en/workshop/intermediate/article-reader.md)</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/0151147a-ae58-4b76-b149-8824445720b3?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/0151147a-ae58-4b76-b149-8824445720b3?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/0151147a-ae58-4b76-b149-8824445720b3?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/0151147a-ae58-4b76-b149-8824445720b3?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/0151147a-ae58-4b76-b149-8824445720b3?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/0151147a-ae58-4b76-b149-8824445720b3?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Dec 24, 2024):

Fixed in https://github.com/langgenius/dify/pull/12035

@crazywoola commented on GitHub (Dec 24, 2024): Fixed in https://github.com/langgenius/dify/pull/12035
Author
Owner

@Luminous-seed commented on GitHub (Dec 27, 2024):

I've encountered the same problem,
image

the error message is here:
...... filename='test_word_documents_03.docx', extension='.docx', mime_type='application/vnd.openxmlformats-officedocument.wordprocessingml.document', size=27409)] id='12673f3a-08fd-451c-aab1-e9e51e35a544' name='files' description='' selector=['1735260405490', 'files'], please provide a list.

@Luminous-seed commented on GitHub (Dec 27, 2024): I've encountered the same problem, ![image](https://github.com/user-attachments/assets/397d439e-c647-428d-ac5a-762303c605c5) the error message is here: ``` ...... filename='test_word_documents_03.docx', extension='.docx', mime_type='application/vnd.openxmlformats-officedocument.wordprocessingml.document', size=27409)] id='12673f3a-08fd-451c-aab1-e9e51e35a544' name='files' description='' selector=['1735260405490', 'files'], please provide a list. ```
Author
Owner

@yihong0618 commented on GitHub (Dec 27, 2024):

I've encountered the same problem, image

the error message is here: ...... filename='test_word_documents_03.docx', extension='.docx', mime_type='application/vnd.openxmlformats-officedocument.wordprocessingml.document', size=27409)] id='12673f3a-08fd-451c-aab1-e9e51e35a544' name='files' description='' selector=['1735260405490', 'files'], please provide a list.

did you try #12035?

@yihong0618 commented on GitHub (Dec 27, 2024): > I've encountered the same problem, ![image](https://private-user-images.githubusercontent.com/58999828/398863504-397d439e-c647-428d-ac5a-762303c605c5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzUyODAxNDQsIm5iZiI6MTczNTI3OTg0NCwicGF0aCI6Ii81ODk5OTgyOC8zOTg4NjM1MDQtMzk3ZDQzOWUtYzY0Ny00MjhkLWFjNWEtNzYyMzAzYzYwNWM1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDEyMjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQxMjI3VDA2MTA0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE0MDhmZGUyMTg1NWMwYTJlYTI0ODAzMDBiNTE3MDg0ZGZmMzU2MjNiYmYyMmEzNDAyOGEyZjFjNDAzNDY2MTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.N2CTdVMRpj9TpwKhIAe1xUmWiTHLBQee6bNSTEeh9d4) > > the error message is here: `...... filename='test_word_documents_03.docx', extension='.docx', mime_type='application/vnd.openxmlformats-officedocument.wordprocessingml.document', size=27409)] id='12673f3a-08fd-451c-aab1-e9e51e35a544' name='files' description='' selector=['1735260405490', 'files'], please provide a list.` did you try #12035?
Author
Owner

@Luminous-seed commented on GitHub (Dec 27, 2024):

my dify is deployed with docker. It seems that I should change the api/core/variables/variables.py in the container,like this:

(in my docker contianer: docker-api-1 (378369d8c876))
root@378369d8c876:/app/api/core/variables# ls
__init__.py  __pycache__  exc.py  segment_group.py  segments.py  types.py  variables.py

the change is :

- class ArrayFileVariable(ArrayFileSegment, Variable):
+ class ArrayFileVariable(ArrayFileSegment, ArrayVariable):

then I restat the whole docker compose.
The problem is resolved !!!!!!!!!!!!!!!!!
image

Thank you ! I also hope that everyone can refer to my case study

@Luminous-seed commented on GitHub (Dec 27, 2024): my dify is deployed with docker. It seems that I should change the ``` api/core/variables/variables.py ``` in the container,like this: ``` (in my docker contianer: docker-api-1 (378369d8c876)) root@378369d8c876:/app/api/core/variables# ls __init__.py __pycache__ exc.py segment_group.py segments.py types.py variables.py ``` the change is : ``` - class ArrayFileVariable(ArrayFileSegment, Variable): + class ArrayFileVariable(ArrayFileSegment, ArrayVariable): ``` then I restat the whole docker compose. The problem is resolved !!!!!!!!!!!!!!!!! ![image](https://github.com/user-attachments/assets/1e4b6ceb-3012-4319-adbe-886a70c3fce2) Thank you ! I also hope that everyone can refer to my case study
Author
Owner

@yihong0618 commented on GitHub (Dec 27, 2024):

my dify is deployed with docker. It seems that I should change the api/core/variables/variables.py in the container,like this:

(in my docker contianer: docker-api-1 (378369d8c876))
root@378369d8c876:/app/api/core/variables# ls
__init__.py  __pycache__  exc.py  segment_group.py  segments.py  types.py  variables.py

the change is :

- class ArrayFileVariable(ArrayFileSegment, Variable):
+ class ArrayFileVariable(ArrayFileSegment, ArrayVariable):

then I restat the whole docker compose. The problem is resolved !!!!!!!!!!!!!!!!! image

Thank you ! I also hope that everyone can refer to my case study

my pleasure and you can wait for the next release~

@yihong0618 commented on GitHub (Dec 27, 2024): > my dify is deployed with docker. It seems that I should change the `api/core/variables/variables.py` in the container,like this: > > ``` > (in my docker contianer: docker-api-1 (378369d8c876)) > root@378369d8c876:/app/api/core/variables# ls > __init__.py __pycache__ exc.py segment_group.py segments.py types.py variables.py > ``` > > the change is : > > ``` > - class ArrayFileVariable(ArrayFileSegment, Variable): > + class ArrayFileVariable(ArrayFileSegment, ArrayVariable): > ``` > > then I restat the whole docker compose. The problem is resolved !!!!!!!!!!!!!!!!! ![image](https://private-user-images.githubusercontent.com/58999828/398871105-1e4b6ceb-3012-4319-adbe-886a70c3fce2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzUyODI4OTAsIm5iZiI6MTczNTI4MjU5MCwicGF0aCI6Ii81ODk5OTgyOC8zOTg4NzExMDUtMWU0YjZjZWItMzAxMi00MzE5LWFkYmUtODg2YTcwYzNmY2UyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDEyMjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQxMjI3VDA2NTYzMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFhZTIwZDFhZTdkOGI3YzBiMDhlZGEwMWQ5YTNlOTRlMTM4YjNkN2IxMWE3YjJlNGFiZTNiYjIxNmQ0YzhlNjQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.drvKVta-FTsA7hYm2Gf4BUvi7iyau5AxdlPYPrpR1TM) > > Thank you ! I also hope that everyone can refer to my case study my pleasure and you can wait for the next release~
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7376