ComfyUI Node: index

Class Name

Basic data handling: ListIndex

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

index Description

The `ListIndex` node locates the first occurrence of a value in a list, returning -1 if not found.

index:

The ListIndex node is designed to help you find the position of a specific value within a list. This node is particularly useful when you need to identify the first occurrence of a value in a list, which can be crucial for tasks that require precise data manipulation or analysis. By providing the ability to specify a range within the list to search, the node offers flexibility and efficiency, ensuring that you can focus on the relevant portion of your data. If the value is not found, the node returns -1, allowing you to handle such cases gracefully in your workflow.

index Input Parameters:

list

This parameter represents the list in which you want to search for a specific value. It can contain any type of elements, and the node will attempt to find the first occurrence of the specified value within this list. The list is the primary data structure that the node operates on, and its content directly impacts the node's execution and results.

value

The value parameter is the specific item you are searching for within the list. It can be of any data type, matching the types of elements within the list. The node will return the index of the first occurrence of this value, or -1 if the value is not present.

start

This optional parameter specifies the starting index from which the search should begin. It defaults to 0, meaning the search will start from the beginning of the list. Adjusting this parameter allows you to limit the search to a specific portion of the list, which can be useful for optimizing performance or focusing on a particular segment of your data.

end

The end parameter is optional and defines the index at which the search should stop. By default, it is set to -1, which indicates that the search should continue to the end of the list. Like the start parameter, this allows you to narrow the search range, potentially improving efficiency and relevance.

index Output Parameters:

index

The index output parameter provides the position of the first occurrence of the specified value within the list. If the value is found, this parameter returns the index as an integer. If the value is not present in the list, it returns -1. This output is crucial for determining the presence and position of elements within your data, enabling further processing or decision-making based on the results.

index Usage Tips:

  • Use the start and end parameters to limit the search range, which can improve performance when dealing with large lists.
  • If you expect the value might not be present, prepare to handle the -1 return value to avoid unexpected behavior in your workflow.

index Common Errors and Solutions:

ValueError: list.index(x): x not in list

  • Explanation: This error occurs when the specified value is not found within the list.
  • Solution: Ensure that the value you are searching for is present in the list. You can also handle the -1 return value to manage cases where the value is not found.

TypeError: 'NoneType' object is not subscriptable

  • Explanation: This error might occur if the list or value parameters are not properly initialized or passed as None.
  • Solution: Verify that both the list and value parameters are correctly set and not None before executing the node.

index 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.

index