Steps
How we tested, and what is real
On 29 October 2026 we ran 9 real webhook executions on a self-hosted n8n 2.43.7 (SQLite, internal JavaScript task runner, Node 24) with the memory caps set low on purpose:
NODE_OPTIONS=--max-old-space-size=512for the main process andN8N_RUNNERS_MAX_OLD_SPACE_SIZE=256for the task runner, then 2048 and 1024 for the fix runs. A local server sent a 134 MB JSON array (600,000 objects) and a 300 MB binary file. Every error text, status code and log line below is what n8n really printed.First, find out which process ran out of memory
n8n runs Code nodes in a separate task runner with its own memory cap. When the runner died, the log line started with
[runner:js]:FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory, and n8n itself stayed up. When the main process died, the same FATAL ERROR came with[n8n start]in the stack and the whole instance went down: editor, webhooks and every other workflow. The process that died tells you which setting to raise (step 6)."Node ran out of memory" on a Code node
Our Code node building 3 million items failed with
Node ran out of memoryand the hintThis usually happens when there are too many items to process., namingN8N_RUNNERS_MAX_OLD_SPACE_SIZE. The webhook caller got HTTP 500{"message":"Error in workflow"}after 0.8 s, and the server log addedWebhook execution failed before a response was sent. The runner restarted by itself. A Code node returning 400,000 small items (200 characters each) under the same 256 MB cap worked, so it is the total data held at once that matters, not only the item count."Workflow did not finish, possible out-of-memory issue"
An HTTP Request node fetching the 134 MB JSON with the default JSON response under a 512 MB main heap killed the whole n8n process. The caller got no answer at all (connection dropped, curl showed HTTP 000), and n8n stayed down until we started it again: without a Docker restart policy or systemd nothing brings it back. After the restart the log said
This could be due to a crash of an active workflow or a restart of n8n, and the execution was marked crashed withWorkflow did not finish, possible out-of-memory issueon the HTTP Request node.Big downloads: use Response Format Text or File, not JSON
Parsed JSON costs several times its size on disk. The same 134 MB file fetched with Response Format: Text worked under the 512 MB heap (one long string, not 600,000 objects). A 300 MB file fetched with Response Format: File worked in 0.9 s, because binary data is not kept as JavaScript objects. For big payloads, download as File, then read it in parts (Extract from File, Split Out) inside a sub-workflow that returns only a small result.
Raise the right setting, and know it is not always enough
Main process (whole instance down,
possible out-of-memory issue): setNODE_OPTIONS=--max-old-space-size=2048(MB). With that, the 134 MB JSON fetch worked (HTTP 200, 3.4 s). Code node ([runner:js],Node ran out of memory): setN8N_RUNNERS_MAX_OLD_SPACE_SIZE=1024; raising only NODE_OPTIONS does nothing for the runner. In docker-compose, both go underenvironment:. Keep the container memory limit above the heap you set, or the system kills the container first (we did not test that part). Even at 1024 MB our 3-million-item Code node still failed: more memory was not the fix there.The real fix: process less at once
Split the work with Loop Over Items into batches, and put the heavy part in a sub-workflow (Execute Workflow) that returns only a few fields, so each batch is freed when it ends. Use pagination on the HTTP Request node instead of one huge call, and remove big fields you do not need with Edit Fields as early as you can.
All test results
9 real executions; some rows group a run with its log. Left: what we ran. Right: what n8n 2.43.7 did (all real).
| Test | Result |
|---|---|
| Code node builds 3,000,000 items, runner cap 256 MB | Node error Node ran out of memory; caller HTTP 500 {"message":"Error in workflow"} in 0.8 s; n8n stays up |
| Same, runner log | [runner:js] FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory; runner restarts by itself |
| Same, runner cap raised to 1024 MB | Still fails (HTTP 500): needs batching |
| Same, only NODE_OPTIONS raised | No change: the runner has its own cap |
| Code node returns 400,000 small items, runner cap 256 MB | Works (HTTP 200, 4 s) |
| HTTP Request, 134 MB JSON, Response Format JSON, main heap 512 MB | Whole n8n process dies; caller gets no response (HTTP 000); editor and all workflows down |
| After restarting n8n | Execution status crashed: Workflow did not finish, possible out-of-memory issue on the HTTP Request node |
| Same fetch, Response Format Text, 512 MB | Works |
| 300 MB file, Response Format File, 512 MB | Works in 0.9 s |
| 134 MB JSON fetch, main heap 2048 MB | Works (HTTP 200, 3.4 s) |
Checklist
- Log line starts with
[runner:js]or the node says Node ran out of memory? It is the Code node runner: raiseN8N_RUNNERS_MAX_OLD_SPACE_SIZEand batch. - Whole instance down, or a crashed execution saying possible out-of-memory issue? It is the main process: raise
NODE_OPTIONS=--max-old-space-size. - Big download? Response Format File or Text, not JSON.
- Many items? Loop Over Items plus a sub-workflow that returns little.
- Add a restart policy (
restart: unless-stopped) so a crash does not leave n8n down. - Keep the container memory limit above the heap you set.
Good to know
- Payload too large, a vague 500 on big webhook bodies or a 413: n8n 413 Request Entity Too Large, payload limits tested.
- Batching with Loop Over Items not doing what you expect? See n8n Loop Over Items not working.
- Moving the heavy part into a sub-workflow: n8n Execute Workflow (sub-workflow) not working. Other Code node errors: n8n Code node errors. Other HTTP Request errors: n8n HTTP Request node errors.
- n8n not coming back after a crash? n8n self-hosted not starting.
- Every error text from our n8n guides is in the n8n error message index.
What we did not test
Docker memory limits and the system OOM killer (exit code 137), queue mode workers, Postgres, n8n Cloud plan limits, the Python Code node, and the Loop Over Items plus sub-workflow fix end to end.
Start from a working agent
FAQ
What does "JavaScript heap out of memory" mean in n8n?
A Node.js process hit its memory cap. If the log line starts with [runner:js] it was the Code node task runner; otherwise it was the main n8n process, which takes the whole instance down.
How do I fix "Node ran out of memory" in n8n?
Process fewer items at once with Loop Over Items or a sub-workflow, and raise N8N_RUNNERS_MAX_OLD_SPACE_SIZE. In our test more memory alone did not fix a 3-million-item Code node.
What does "Workflow did not finish, possible out-of-memory issue" mean?
n8n crashed during the execution, usually from the main process running out of memory, and marked the run crashed after restarting. Raise NODE_OPTIONS=--max-old-space-size and avoid loading huge JSON at once.
Does NODE_OPTIONS max-old-space-size help the Code node?
No. The Code node runs in the task runner, which has its own cap set by N8N_RUNNERS_MAX_OLD_SPACE_SIZE.
How do I download a large file in n8n without running out of memory?
Set the HTTP Request Response Format to File. A 300 MB file worked under a 512 MB heap in our test, while a 134 MB JSON response crashed n8n.
Related guides
- n8n OpenAI node not working? 18 tests, every error decoded
- n8n next node not running? Empty output and Always Output Data, 18 tests
- n8n HTTP Request node errors: 401, 404, ECONNREFUSED, SSL and 12 more, fixed
- n8n AI Agent node not working? 18 tests, every error decoded
- n8n Python Code node not working? Task runner errors, 9 tests
New guides
- GitHub release notifications in Slack (any public repo, stable releases only)
- Send RSS feeds to Slack with a keyword filter (free, incoming webhook)
- Forward emails to a Slack channel (Gmail, Outlook, any IMAP), free with an incoming webhook
- n8n Google Sheets Trigger not working: not firing, activation errors and fixes