Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dify reported an error when displaying file iterations, indicating "invalid iterator value: value_type=<SegmentType.ARRAY_FILE: 'array[file]'> ." #12219

Closed
5 tasks done
qkfm-97 opened this issue Dec 30, 2024 · 2 comments
Labels
🐞 bug Something isn't working

Comments

@qkfm-97
Copy link

qkfm-97 commented Dec 30, 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

Self Hosted (Docker)

Steps to reproduce

this is the full error

invalid iterator value: value_type=<SegmentType.ARRAY_FILE: 'array[file]'> value=[File(dify_model_identity='dify__file', id=None, tenant_id='4d6d8447-60c2-4488-b6cd-e110602a1db5', type=<FileType.DOCUMENT: 'document'>, transfer_method=<FileTransferMethod.LOCAL_FILE: 'local_file'>, remote_url='', related_id='388974e9-df07-430b-91e8-b31aa058017a', filename='第01集知识点总结.pdf', extension='.pdf', mime_type='application/pdf', size=373038), File(dify_model_identity='dify__file', id=None, tenant_id='4d6d8447-60c2-4488-b6cd-e110602a1db5', type=<FileType.DOCUMENT: 'document'>, transfer_method=<FileTransferMethod.LOCAL_FILE: 'local_file'>, remote_url='', related_id='0f27b89f-bfaf-4460-8c37-c9e8a15f7a93', filename='第07集知识点总结.pdf', extension='.pdf', mime_type='application/pdf', size=509967)] id='80b1a8ed-9e84-470f-8ec5-69dac4a44951' name='filearr' description='' selector=['1735529468276', 'filearr'], please provide a list.

11

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

Copy link

dosubot bot commented Dec 30, 2024

Hey there, @qkfm-97! I'm here to help you with any bugs, questions, or contributions you have for the Dify project. Let me know how I can assist you with the reported error.

I found a similar closed issue that might help you resolve the error you're encountering. The solution involves updating 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. Additionally, ensure you add a 'list filter' node to handle the array of files, as sys.files is an Array[File] type variable, not a single File type. This will help process the file array correctly in your 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 dosubot bot added the 🐞 bug Something isn't working label Dec 30, 2024
@crazywoola
Copy link
Member

See above answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants