//n8n pitfalls · medium
Code node $input.all() vs $input.first()
$input.all() returns ALL items from the previous node as an array. $input.first() returns only the first item. When processing multiple items, always use $input.all() and iterate, or use the "Run Once for Each Item" mode. Common mistake: using $input.first() when multiple items are expected.
- Category
- n8n_general
Source: the n8n-mcp pitfall list, maintained by the tool's author
Mistakes AI agents make in n8n
- Execute Workflow + Wait nodes cause data loss
- SplitInBatches + Wait nodes cause state loss
- Never use append on sheets with formula columns
- $env expressions blocked in Code nodes
- saveExecutionProgress fills disk space
- IF node uses branch true/false not sourceIndex
- Per-item execution on large datasets
- Webhook node response must be sent explicitly
- Error Trigger workflow must be separate
- $getWorkflowStaticData global loses data in loops