AiAdvisors
Back to the index
//n8n pitfalls · high

$getWorkflowStaticData global loses data in loops

When looping via Code → HTTP Request → Code → If → back to HTTP Request, the HTTP Request node overwrites $json with the API response. Any loop state passed via $json (iteration counter, accumulated data) is lost on every iteration. Fix: use $getWorkflowStaticData('global') to persist loop state across iterations. Always reset staticData at the start of each workflow run because it persists across runs (saved to DB) — stale data from failed executions can leak in otherwise.

Category
n8n_general

Source: the n8n-mcp pitfall list, maintained by the tool's author

Mistakes AI agents make in n8n

//Contact

Let's talk about AI in your business

Book a free strategic consultation and discover what AI can do for your company.

or write: romuald@aiadvisors.pl · +48 695 263 884