n8n input limits: keeping first or last items with Limit
Limit item count before AI processing, check first/last selection and input order, and keep item limits separate from token budgets.
Confirm count and order first · Set Max Items and Keep · Place it before the stage to limit
At a glance
The goal is to select a bounded number of input items for a small inspection batch. Upstream must already return an item list with a known order. Synthetic ids model first/last selection from the official Limit page. n8n was not run, and model pricing and request quotas were not verified.
Input, configuration and output checks
Prepare input
Define identifiers, fields and the intended output before configuration.
Inspect settings
Inspect the documented operation and its relevant options.
Verify and stop
Inspect identifiers and results before downstream processing; stop when the contract is unclear.
Confirm count and order first
Prepare five synthetic inputs a, b, c, d, e and define order as their current list arrangement. Limit does not sort text or judge relevance; it removes items beyond a maximum count. Check whether upstream ordering fits the goal. Last Items does not mean newest unless a time-order contract actually establishes that input order.
Set Max Items and Keep
Set Max Items to the maximum count to retain, then choose First Items or Last Items in Keep. With 2 in the exercise, documented behavior implies a, b from the start or d, e from the end. This was modeled by local array slicing, not node execution. The page does not define handling of zero, negative or non-integer values; the exercise avoids them, and their behavior needs a separate check if your editor permits them.
Place it before the stage to limit
To bound records entering a later AI node, place Limit before that stage and inspect retained items in the connection. Applying it after model calls limits later results and cannot undo prior requests. Item count is not text length, token count or an external API rate-limit unit; even two records can each contain long text. Check model context and cost conditions against the actual service separately.
Verify input-to-output identity
Local checks covered first/last slicing, retaining all items below the limit and a modeled empty input. n8n empty-input scheduling was not verified. In a workflow, check that output count stays within the setting, ids belong to input and text is retained. If content or ordering differs, stop later model calls and inspect placement, Keep and upstream data flow. Truncation is not complete processing of every record.
Article sources
Original editorial content; official descriptions and checking suggestions are distinguished.