ComfyUI Node: first

Class Name

Basic data handling: ListFirst

Category
Basic/LIST
Author
StableLlama (Account age: 861days)
Extension
Basic data handling
Latest Updated
2026-05-07
Github Stars
0.04K

How to Install Basic data handling

Install this extension via the ComfyUI Manager by searching for Basic data handling
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Basic data handling 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
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

first Description

ListFirst node retrieves the first element from a list, returning `None` for empty lists.

first:

The ListFirst node is designed to simplify the process of retrieving the first element from a list. This node is particularly useful when you need to quickly access the initial item in a sequence without manually indexing the list. It is a straightforward tool that enhances efficiency by automating the retrieval of the first element, which can be beneficial in various scenarios, such as when processing data streams or handling collections of items. The node is robust enough to handle empty lists gracefully by returning None, ensuring that your workflow remains uninterrupted even when the list lacks elements. This feature makes it a reliable choice for AI artists who need to manage lists effectively without delving into complex programming logic.

first Input Parameters:

list

The list parameter is the primary input for the ListFirst node. It accepts a list of any data type, allowing you to pass in a collection of elements from which the node will extract the first item. The parameter does not have a predefined minimum or maximum value, as it can accommodate lists of varying lengths, including empty lists. When the list is empty, the node will return None, ensuring that your workflow can handle such cases without errors. This flexibility makes the list parameter versatile and adaptable to different data handling needs.

first Output Parameters:

first_element

The first_element output parameter provides the first item from the input list. If the list contains elements, this parameter will return the first one, effectively allowing you to access the initial data point in your sequence. In cases where the list is empty, the first_element will return None, indicating the absence of elements. This output is crucial for workflows that require the initial element for further processing or decision-making, offering a simple yet effective way to manage list data.

first Usage Tips:

  • Ensure that the list you provide to the node is not empty if you expect a meaningful output, as an empty list will result in a None value.
  • Use this node in conjunction with other list manipulation nodes to streamline workflows that require frequent access to the first element of lists.

first Common Errors and Solutions:

IndexError: list index out of range

  • Explanation: This error occurs when attempting to access an element from an empty list.
  • Solution: Ensure that the list provided to the node contains at least one element, or handle the None output appropriately in your workflow to avoid this error.

TypeError: 'NoneType' object is not subscriptable

  • Explanation: This error happens when you try to access an element from a None value, which is returned when the input list is empty.
  • Solution: Check if the first_element output is None before attempting to access its contents, and implement logic to handle such cases gracefully.

first Related Nodes

Go back to the extension to check out more related nodes.
Basic data handling
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

first