Skip to content

Accumulation Head

Extracts the first element (head) from an accumulation. If the accumulation is empty or invalid, it outputs None. The node is type-agnostic and returns the element in its original type.
Preview

Usage

Use this node when you are incrementally building a list of values with Accumulate (or converting a list to an accumulation) and need to read the first item in that collection. Typical in iterative workflows, conditional branching, or when peeking at the current leading value without modifying the accumulation.

Inputs

FieldRequiredTypeDescriptionExample
accumulationTrueACCUMULATIONAn accumulation object containing a list of values under the internal key. Usually produced by Accumulate or List to Accumulation.{'accum': ['first', 'second', 'third']}

Outputs

FieldTypeDescriptionExample
headWILDCARDThe first element of the accumulation. Returns None if the accumulation is empty or not properly formed.first

Important Notes

  • Returns None for empty inputs: If the accumulation has no items or is malformed, the output will be None.
  • Type-agnostic output: The output type matches the type of the first element in the accumulation (string, number, image, etc.).
  • Requires a valid accumulation: Ensure the input is produced by compatible nodes like Accumulate or List to Accumulation.
  • Non-mutating: This node does not modify the accumulation; it only reads the first element.

Troubleshooting

  • Got None instead of a value: Verify the accumulation is not empty and is a valid accumulation object (e.g., produced by Accumulate).
  • Unexpected type on output: Remember the output type is the same as the first element's type. Check the data being added to the accumulation.
  • Head doesn't match expected item: Ensure items are added in the intended order to the accumulation (new items are appended, so the head is the earliest added item unless the accumulation was constructed differently).