Iteration node cannot output the file list #22106

Open
opened 2026-02-21 20:15:48 -05:00 by yindo · 3 comments
Owner

Originally created by @sunzhouxingjay on GitHub (Feb 5, 2026).

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

the version you display on cloud.dify.ai

Cloud or Self Hosted

Cloud

Steps to reproduce

Image Image

✔️ Expected Behavior

On cloud.dify.ai, the iteration node can return the list of file

Actual Behavior

On cloud.dify.ai, I have encountered an issue where the iteration node gets stuck or throws errors when returning a list in file format. I am certain this worked correctly on February 3rd, as I used it that day. However, today I found that it can no longer run on cloud.dify.ai, while the exact same workflow runs normally on my self-hosted Dify instance.
You can see from the screenshot that the list only contains two elements and execution has completed, yet the iteration node is stuck in Running state.

Originally created by @sunzhouxingjay on GitHub (Feb 5, 2026). ### 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 the version you display on cloud.dify.ai ### Cloud or Self Hosted Cloud ### Steps to reproduce <img width="2164" height="880" alt="Image" src="https://github.com/user-attachments/assets/8627bad6-2575-4d62-afb7-2c0a37bf64cc" /> <img width="2560" height="1392" alt="Image" src="https://github.com/user-attachments/assets/ba05037e-69a8-4a76-96fe-0bdb812291e7" /> ### ✔️ Expected Behavior On cloud.dify.ai, the iteration node can return the list of file ### ❌ Actual Behavior On cloud.dify.ai, I have encountered an issue where the iteration node gets stuck or throws errors when returning a list in file format. I am certain this worked correctly on February 3rd, as I used it that day. However, today I found that it can no longer run on cloud.dify.ai, while the exact same workflow runs normally on my self-hosted Dify instance. You can see from the screenshot that the list only contains two elements and execution has completed, yet the iteration node is stuck in Running state.
yindo added the 🐞 bugcloud labels 2026-02-21 20:15:48 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 5, 2026):

Hi @sunzhouxingjay! I'm Dosu and I’m helping the dify team.

This is a known bug affecting iteration nodes when outputting file lists, especially after recent updates to cloud.dify.ai. The root cause is a gap in how the workflow engine signals completion for iteration and loop nodes, which was fixed in PR #26036 and related updates, but these fixes may not be present in the current cloud deployment yet. Users have reported that workflows with iteration nodes freeze in the running state after the 1.9.0 update, both in cloud and self-hosted environments, until the fix is applied source.

Workarounds that have helped others include: double-checking that your output_selector is set correctly, switching the iteration node to serial execution (not parallel), ensuring input and output variables for the iteration node are array types, and using a code node to manually aggregate results if needed source.

If these do not resolve the issue, the most reliable solution is to upgrade to a Dify version that includes the fix from PR #26036 or later. Maintainers have acknowledged the issue and confirmed it is fixed in PR #26133, so you may want to check if/when the cloud deployment will be updated to include these changes.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Feb 5, 2026): <!-- Greeting --> Hi @sunzhouxingjay! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> This is a known bug affecting iteration nodes when outputting file lists, especially after recent updates to cloud.dify.ai. The root cause is a gap in how the workflow engine signals completion for iteration and loop nodes, which was fixed in [PR #26036](https://github.com/langgenius/dify/pull/26036) and related updates, but these fixes may not be present in the current cloud deployment yet. Users have reported that workflows with iteration nodes freeze in the running state after the 1.9.0 update, both in cloud and self-hosted environments, until the fix is applied [source](https://github.com/langgenius/dify/issues/26097#issuecomment-3322642589). Workarounds that have helped others include: double-checking that your `output_selector` is set correctly, switching the iteration node to serial execution (not parallel), ensuring input and output variables for the iteration node are array types, and using a code node to manually aggregate results if needed [source](https://github.com/langgenius/dify/issues/27261#issuecomment-3430821585). If these do not resolve the issue, the most reliable solution is to upgrade to a Dify version that includes the fix from PR #26036 or later. Maintainers have acknowledged the issue and confirmed it is fixed in PR #26133, so you may want to check if/when the cloud deployment will be updated to include these changes. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/6fcb372d-eee7-4fab-83d3-02241194666f?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/6fcb372d-eee7-4fab-83d3-02241194666f?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/6fcb372d-eee7-4fab-83d3-02241194666f?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/6fcb372d-eee7-4fab-83d3-02241194666f?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6fcb372d-eee7-4fab-83d3-02241194666f?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/6fcb372d-eee7-4fab-83d3-02241194666f?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/6fcb372d-eee7-4fab-83d3-02241194666f?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20known%20bug%20affecting%20iteration%20nodes%20when%20outputting%20file%20lists%2C%20especially%20after%20recent%20updates%20to%20cloud.dify.ai.%20The%20root%20cause%20is%20a%20gap%20in%20how%20the%20workflow%20engine%20signals%20completion%20for%20iteration%20and%20loop%20nodes%2C%20which%20was%20fixed%20in%20%5BPR%20%2326036%5D%28https%3A//github.com/langgenius/dify/pull/26036%29%20and%20related%20updates%2C%20but%20these%20fixes%20may%20not%20be%20present%20in%20the%20current%20cloud%20deployment%20yet.%20Users%20have%20reported%20that%20workflows%20with%20iteration%20nodes%20freeze%20in%20the%20running%20state%20after%20the%201.9.0%20update%2C%20both%20in%20cloud%20and%20self-hosted%20environments%2C%20until%20the%20fix%20is%20applied%20%5Bsource%5D%28https%3A//github.com/langgenius/dify/issues/26097%23issuecomment-3322642589%29.%0A%0AWorkarounds%20that%20have%20helped%20others%20include%3A%20double-checking%20that%20your%20%60output_selector%60%20is%20set%20correctly%2C%20switching%20the%20iteration%20node%20to%20serial%20execution%20%28not%20parallel%29%2C%20ensuring%20input%20and%20output%20variables%20for%20the%20iteration%20node%20are%20array%20types%2C%20and%20using%20a%20code%20node%20to%20manually%20aggregate%20results%20if%20needed%20%5Bsource%5D%28https%3A//github.com/langgenius/dify/issues/27261%23issuecomment-3430821585%29.%0A%0AIf%20these%20do%20not%20resolve%20the%20issue%2C%20the%20most%20reliable%20solution%20is%20to%20upgrade%20to%20a%20Dify%20version%20that%20includes%20the%20fix%20from%20PR%20%2326036%20or%20later.%20Maintainers%20have%20acknowledged%20the%20issue%20and%20confirmed%20it%20is%20fixed%20in%20PR%20%2326133%2C%20so%20you%20may%20want%20to%20check%20if/when%20the%20cloud%20deployment%20will%20be%20updated%20to%20include%20these%20changes.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/32020)
Author
Owner

@sunzhouxingjay commented on GitHub (Feb 5, 2026):

Image But why do I get an error instead of getting stuck when I call a file‑returning workflow inside an iteration node? Is this the same bug? [@dosu](https://go.dosu.dev/dosubot)
@sunzhouxingjay commented on GitHub (Feb 5, 2026): <img width="2560" height="1392" alt="Image" src="https://github.com/user-attachments/assets/9aeffaee-1b70-412b-8abf-8353f19fa727" /> But why do I get an error instead of getting stuck when I call a file‑returning workflow inside an iteration node? Is this the same bug? [@dosu](https://go.dosu.dev/dosubot)
Author
Owner

@dosubot[bot] commented on GitHub (Feb 5, 2026):

You're seeing a validation error about a missing file_marker (instead of the node just getting stuck) because recent Dify/cloud versions now strictly enforce the file output schema using Pydantic. The iteration node expects each file output to include this file_marker field, but if a file is returned as a plain dict or missing required metadata, validation fails and you get an explicit error rather than a silent hang. This is a different symptom of the same underlying bug: improper construction or handling of file outputs in iteration nodes, which previously could cause the node to freeze or get stuck, but now surfaces as a clear validation error due to improved error handling and schema checks (source).

To avoid this, make sure any file output from your iteration node is constructed as a proper FileVariable (not a raw dict), so it includes all required metadata like file_marker. If you’re building file outputs manually or using a code node, you can convert a raw file dict into a FileVariable using something like:

from core.file import FileTransferMethod
from factories import file_factory
from core.variables.variables import FileVariable
from core.variables.segments import SegmentType
from factories.variable_factory import build_segment_with_type

def generate_file_var(param_name, file_dict, tenant_id, node_id):
    related_id = file_dict.get("related_id")
    transfer_method_value = file_dict.get("transfer_method")
    if transfer_method_value:
        transfer_method = FileTransferMethod.value_of(transfer_method_value)
        if transfer_method in [FileTransferMethod.LOCAL_FILE, FileTransferMethod.REMOTE_URL]:
            file_dict["upload_file_id"] = related_id
        elif transfer_method == FileTransferMethod.TOOL_FILE:
            file_dict["tool_file_id"] = related_id
        elif transfer_method == FileTransferMethod.DATASOURCE_FILE:
            file_dict["datasource_file_id"] = related_id

        file_obj = file_factory.build_from_mapping(mapping=file_dict, tenant_id=tenant_id)
        file_segment = build_segment_with_type(SegmentType.FILE, file_obj)
        return FileVariable(name=param_name, value=file_segment.value, selector=[node_id, param_name])
    return None

(reference)

Both the stuck node and the validation error are manifestations of the same root issue, but the error is now surfaced more clearly. Ensuring your file outputs are properly constructed should resolve the validation error and prevent the node from getting stuck. If you can't update your workflow logic, running the workflow end-to-end (not single-step) or using a code node to manually fix file outputs can be a temporary workaround.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Feb 5, 2026): <!-- Answer --> You're seeing a validation error about a missing `file_marker` (instead of the node just getting stuck) because recent Dify/cloud versions now strictly enforce the file output schema using Pydantic. The iteration node expects each file output to include this `file_marker` field, but if a file is returned as a plain dict or missing required metadata, validation fails and you get an explicit error rather than a silent hang. This is a different symptom of the same underlying bug: improper construction or handling of file outputs in iteration nodes, which previously could cause the node to freeze or get stuck, but now surfaces as a clear validation error due to improved error handling and schema checks [(source)](https://github.com/langgenius/dify/blob/095b3ee234ddbfdfb507267bb21b0cc4bb83255b/api/core/tools/entities/tool_entities.py#L128-L239). To avoid this, make sure any file output from your iteration node is constructed as a proper FileVariable (not a raw dict), so it includes all required metadata like `file_marker`. If you’re building file outputs manually or using a code node, you can convert a raw file dict into a FileVariable using something like: ```python from core.file import FileTransferMethod from factories import file_factory from core.variables.variables import FileVariable from core.variables.segments import SegmentType from factories.variable_factory import build_segment_with_type def generate_file_var(param_name, file_dict, tenant_id, node_id): related_id = file_dict.get("related_id") transfer_method_value = file_dict.get("transfer_method") if transfer_method_value: transfer_method = FileTransferMethod.value_of(transfer_method_value) if transfer_method in [FileTransferMethod.LOCAL_FILE, FileTransferMethod.REMOTE_URL]: file_dict["upload_file_id"] = related_id elif transfer_method == FileTransferMethod.TOOL_FILE: file_dict["tool_file_id"] = related_id elif transfer_method == FileTransferMethod.DATASOURCE_FILE: file_dict["datasource_file_id"] = related_id file_obj = file_factory.build_from_mapping(mapping=file_dict, tenant_id=tenant_id) file_segment = build_segment_with_type(SegmentType.FILE, file_obj) return FileVariable(name=param_name, value=file_segment.value, selector=[node_id, param_name]) return None ``` [(reference)](https://github.com/langgenius/dify/issues/29746) Both the stuck node and the validation error are manifestations of the same root issue, but the error is now surfaced more clearly. Ensuring your file outputs are properly constructed should resolve the validation error and prevent the node from getting stuck. If you can't update your workflow logic, running the workflow end-to-end (not single-step) or using a code node to manually fix file outputs can be a temporary workaround. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/58c8b586-a937-43ef-b456-5b1de30e4363?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/58c8b586-a937-43ef-b456-5b1de30e4363?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/58c8b586-a937-43ef-b456-5b1de30e4363?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/58c8b586-a937-43ef-b456-5b1de30e4363?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/58c8b586-a937-43ef-b456-5b1de30e4363?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/58c8b586-a937-43ef-b456-5b1de30e4363?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/58c8b586-a937-43ef-b456-5b1de30e4363?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=You%27re%20seeing%20a%20validation%20error%20about%20a%20missing%20%60file_marker%60%20%28instead%20of%20the%20node%20just%20getting%20stuck%29%20because%20recent%20Dify/cloud%20versions%20now%20strictly%20enforce%20the%20file%20output%20schema%20using%20Pydantic.%20The%20iteration%20node%20expects%20each%20file%20output%20to%20include%20this%20%60file_marker%60%20field%2C%20but%20if%20a%20file%20is%20returned%20as%20a%20plain%20dict%20or%20missing%20required%20metadata%2C%20validation%20fails%20and%20you%20get%20an%20explicit%20error%20rather%20than%20a%20silent%20hang.%20This%20is%20a%20different%20symptom%20of%20the%20same%20underlying%20bug%3A%20improper%20construction%20or%20handling%20of%20file%20outputs%20in%20iteration%20nodes%2C%20which%20previously%20could%20cause%20the%20node%20to%20freeze%20or%20get%20stuck%2C%20but%20now%20surfaces%20as%20a%20clear%20validation%20error%20due%20to%20improved%20error%20handling%20and%20schema%20checks%20%5B%28source%29%5D%28https%3A//github.com/langgenius/dify/blob/095b3ee234ddbfdfb507267bb21b0cc4bb83255b/api/core/tools/entities/tool_entities.py%23L128-L239%29.%0A%0ATo%20avoid%20this%2C%20make%20sure%20any%20file%20output%20from%20your%20iteration%20node%20is%20constructed%20as%20a%20proper%20FileVariable%20%28not%20a%20raw%20dict%29%2C%20so%20it%20includes%20all%20required%20metadata%20like%20%60file_marker%60.%20If%20you%E2%80%99re%20building%20file%20outputs%20manually%20or%20using%20a%20code%20node%2C%20you%20can%20convert%20a%20raw%20file%20dict%20into%20a%20FileVariable%20using%20something%20like%3A%0A%0A%60%60%60python%0Afrom%20core.file%20import%20FileTransferMethod%0Afrom%20factories%20import%20file_factory%0Afrom%20core.variables.variables%20import%20FileVariable%0Afrom%20core.variables.segments%20import%20SegmentType%0Afrom%20factories.variable_factory%20import%20build_segment_with_type%0A%0Adef%20generate_file_var%28param_name%2C%20file_dict%2C%20tenant_id%2C%20node_id%29%3A%0A%20%20%20%20related_id%20%3D%20file_dict.get%28%22related_id%22%29%0A%20%20%20%20transfer_method_value%20%3D%20file_dict.get%28%22transfer_method%22%29%0A%20%20%20%20if%20transfer_method_value%3A%0A%20%20%20%20%20%20%20%20transfer_method%20%3D%20FileTransferMethod.value_of%28transfer_method_value%29%0A%20%20%20%20%20%20%20%20if%20transfer_method%20in%20%5BFileTransferMethod.LOCAL_FILE%2C%20FileTransferMethod.REMOTE_URL%5D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20file_dict%5B%22upload_file_id%22%5D%20%3D%20related_id%0A%20%20%20%20%20%20%20%20elif%20transfer_method%20%3D%3D%20FileTransferMethod.TOOL_FILE%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20file_dict%5B%22tool_file_id%22%5D%20%3D%20related_id%0A%20%20%20%20%20%20%20%20elif%20transfer_method%20%3D%3D%20FileTransferMethod.DATASOURCE_FILE%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20file_dict%5B%22datasource_file_id%22%5D%20%3D%20related_id%0A%0A%20%20%20%20%20%20%20%20file_obj%20%3D%20file_factory.build_from_mapping%28mapping%3Dfile_dict%2C%20tenant_id%3Dtenant_id%29%0A%20%20%20%20%20%20%20%20file_segment%20%3D%20build_segment_with_type%28SegmentType.FILE%2C%20file_obj%29%0A%20%20%20%20%20%20%20%20return%20FileVariable%28name%3Dparam_name%2C%20value%3Dfile_segment.value%2C%20selector%3D%5Bnode_id%2C%20param_name%5D%29%0A%20%20%20%20return%20None%0A%60%60%60%0A%5B%28reference%29%5D%28https%3A//github.com/langgenius/dify/issues/29746%29%0A%0ABoth%20the%20stuck%20node%20and%20the%20validation%20error%20are%20manifestations%20of%20the%20same%20root%20issue%2C%20but%20the%20error%20is%20now%20surfaced%20more%20clearly.%20Ensuring%20your%20file%20outputs%20are%20properly%20constructed%20should%20resolve%20the%20validation%20error%20and%20prevent%20the%20node%20from%20getting%20stuck.%20If%20you%20can%27t%20update%20your%20workflow%20logic%2C%20running%20the%20workflow%20end-to-end%20%28not%20single-step%29%20or%20using%20a%20code%20node%20to%20manually%20fix%20file%20outputs%20can%20be%20a%20temporary%20workaround.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/32020)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#22106