ComfyUI  >  Nodes  >  ComfyUI-0246 >  Loop

ComfyUI Node: Loop

Class Name


Trung0246 (Account age: 3389 days)
Latest Updated
Github Stars

How to Install ComfyUI-0246

Install this extension via the ComfyUI Manager by searching for  ComfyUI-0246
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-0246 in the search bar
After installation, click the  Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Loop Description

Facilitates iterative processes within workflows, automating repeated operations until specified condition is met.


The 0246.Loop node is designed to facilitate iterative processes within a workflow, allowing for repeated execution of a set of operations until a specified condition is met. This node is particularly useful for tasks that require multiple passes over data or repeated application of a function, such as refining an image or processing a batch of inputs. By automating the looping mechanism, it helps streamline complex workflows, reducing the need for manual intervention and ensuring consistency in repetitive tasks. The node's primary goal is to enhance efficiency and flexibility in handling iterative operations, making it an essential tool for AI artists who need to perform repetitive tasks within their creative processes.

Loop Input Parameters:


The _prompt parameter is a dictionary that contains the initial inputs and configurations for the node. It serves as the starting point for the loop, providing the necessary data and settings to initiate the iterative process. This parameter is crucial as it defines the initial state and inputs that the loop will work with.


The _id parameter is a unique identifier for the node within the workflow. It ensures that the node can be accurately referenced and tracked throughout the iterative process. This identifier is essential for maintaining the integrity and order of operations within the loop.


The _workflow parameter is a dictionary that outlines the entire workflow, including all nodes and their connections. It provides the context and structure needed for the loop to function correctly, ensuring that each iteration follows the defined workflow. This parameter is vital for coordinating the sequence of operations and managing dependencies between nodes.


The _input parameter is a boolean flag that indicates whether the loop should process input nodes. When set to True, the loop will include input nodes in its iterations, allowing for dynamic updates and changes to the input data during the loop. This parameter is important for workflows that require real-time input adjustments.


The _func parameter is a function that defines the specific operation to be performed during each iteration of the loop. It allows for customization and flexibility in the loop's behavior, enabling users to tailor the iterative process to their specific needs. This parameter is key to defining the core functionality of the loop.

Loop Output Parameters:


The id_res parameter is a set that contains the unique identifiers of all nodes processed during the loop. It provides a comprehensive list of nodes that were involved in the iterative process, allowing users to track and analyze the loop's execution. This output is essential for understanding the scope and impact of the loop within the workflow.

Loop Usage Tips:

  • Ensure that the _prompt parameter is correctly configured with all necessary inputs and settings to avoid initialization errors.
  • Use the _input parameter to dynamically adjust input data during the loop, which can be useful for real-time processing tasks.
  • Customize the _func parameter to define specific operations for each iteration, tailoring the loop to your workflow's requirements.

Loop Common Errors and Solutions:

Type "X" of output "Y" does not available in junction.

  • Explanation: This error occurs when the specified type of output is not found in the junction.
  • Solution: Ensure that the junction contains the required type of output before initiating the loop.

Too much type "X" being taken or offset "Y" is too large (count: "Z").

  • Explanation: This error indicates that the offset value is too large or too many instances of the specified type are being requested.
  • Solution: Adjust the offset value or reduce the number of instances requested to match the available count in the junction.

No input and output to pile up.

  • Explanation: This error occurs when there are no inputs or outputs available for processing in the loop.
  • Solution: Verify that the input and output parameters are correctly configured and contain valid data for the loop to process.

Loop Related Nodes

Go back to the extension to check out more related nodes.

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.