Skip to content

Accumulation Head

Returns the first element (head) from an accumulation. If the accumulation is empty or invalid, it outputs None. Works with any item type and preserves the original type of the head element.
Preview

Usage

Use this node after building an accumulation (e.g., via Accumulate or List to Accumulation) when you need to extract just the first item. Typical in list-processing workflows where you split a collection into head and tail or need to peek at the first value for control logic.

Inputs

FieldRequiredTypeDescriptionExample
accumulationTrueACCUMULATIONAn accumulation object representing a list-like collection produced by other Salt list/accumulation nodes.{'accum': ['hello', 'world']}

Outputs

FieldTypeDescriptionExample
headWILDCARDThe first element of the provided accumulation. Returns None if the accumulation is empty or invalid.hello

Important Notes

  • The output type is WILDCARD and matches the type of the first item in the accumulation.
  • If the accumulation is empty or not a valid accumulation object, the node returns None.
  • Provide a proper ACCUMULATION object (typically produced by Accumulate, List to Accumulation, or related nodes) rather than a raw list.

Troubleshooting

  • Head is None: Ensure the accumulation is not empty and is a valid ACCUMULATION object.
  • Unexpected output type: The node preserves the type of the first element; verify the items being accumulated are of the expected type.
  • Invalid input error or silent None: Feed in an ACCUMULATION from compatible nodes instead of a plain list or mismatched structure.