<figure class="wp-block-image aligncenter"><img src="https://flowgenius.in/wp-content/uploads/2026/01/inside-n8n-execution-engine.png" alt="Step by Step Guide to solve inside n8n execution engine" /><figcaption style="text-align: center;">Step by Step Guide to solve inside n8n execution engine</p>
<hr />
</figcaption></figure>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Who this is for:</strong> developers and DevOps engineers who run n8n in production and need to pinpoint why a step misbehaves (missing data, time‑outs, permission errors, etc.). <strong>We cover this in detail in the </strong><a href="https://flowgenius.in/n8n-architectural-failure-modes/">n8n Architectural Failure Modes Guide.</a></p>
<hr style="margin: 55px 0;" />
<h2 style="margin-bottom: 45px; line-height: 1.3;">Quick Diagnosis</h2>
<p style="margin-bottom: 2em; line-height: 1.9;">If a workflow behaves oddly, first locate <strong>where</strong> the offending code runs—<strong>Main Process</strong>, <strong>Worker Process</strong>, or <strong>Sandbox</strong>—and adjust node settings, credentials, or deployment limits for that context; the problem often disappears.<br />
In production this often shows up as a missing field or a timeout after a few minutes of execution.</p>
<blockquote style="margin: 0 0 2em 0; padding-left: 1em; border-left: 3px solid #e0e0e0;">
<p style="margin-bottom: 0; line-height: 1.9;"><strong>Featured‑snippet answer</strong> – n8n routes each workflow step to one of three runtimes:</p>
<ul style="margin-bottom: 1.8em; line-height: 1.9;">
<li><strong>Main Process</strong> – UI, webhook listeners, and lightweight nodes.</li>
<li><strong>Worker Process</strong> – CPU‑intensive or long‑running nodes in a separate child process.</li>
<li><strong>Sandbox</strong> – Isolated execution of custom JavaScript and credential decryption.</li>
</ul>
<p style="margin-bottom: 0; line-height: 1.9;">The engine decides based on node type, sync/async mode, and available resources.</p>
</blockquote>
<hr style="margin: 55px 0;" />
<h2 style="margin-bottom: 45px; line-height: 1.3;">1. High‑Level Execution Flow</h2>
<p>If you encounter any <a href="/n8n-execution-ordering-guarantees">n8n execution ordering guarantees </a>resolve them before continuing with the setup.</p>
<p style="margin-bottom: 2em; line-height: 1.9;">Below are the major phases and their runtimes.</p>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Phase</th>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Component</th>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Runs In</th>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Typical Tasks</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Trigger Reception</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Webhook / Cron / Manual</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;"><strong>Main Process</strong></td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Accept HTTP request, schedule cron, start manual run</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Node Scheduling</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">`WorkflowRunner`</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;"><strong>Main Process</strong></td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Parse workflow JSON, build execution graph, decide node placement</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Heavy‑Lift Execution</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">`WorkerPool` (child processes)</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;"><strong>Worker Process</strong></td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Run loops, API calls with retries, large data transforms</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Isolated Code</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">`Sandbox` (VM2)</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;"><strong>Sandbox</strong></td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Execute custom JavaScript, credential decryption</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Result Aggregation</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">`WorkflowRunner`</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;"><strong>Main Process</strong></td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Collect node outputs, resolve expressions, write to DB</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Cleanup</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">`ProcessManager`</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;"><strong>Main Process</strong></td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Terminate workers, clear temp files, update status</td>
</tr>
</tbody>
</table>
<p style="margin-bottom: 2em; line-height: 1.9;">The table maps each logical step to its runtime, helping locate the source of a failure.</p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">EEFA notes for each phase</h3>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Phase</th>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">EEFA Note</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Trigger Reception</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Ensure the main process has a high enough <strong>ulimit</strong> for open file descriptors; otherwise webhooks may be dropped.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Node Scheduling</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Mis‑ordered dependencies cause “Node not found” errors – verify <code>nextNode</code> IDs.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Heavy‑Lift Execution</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Worker crashes are logged to <code>worker.log</code>; restart the pool if you see <code>EWORKEREXIT</code>.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Isolated Code</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Sandbox memory defaults to 150 MB. Increase via <code>N8N_SANDBOX_MEMORY_LIMIT</code> only after a security review.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Result Aggregation</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Failures often point to malformed JSON from a node; enable <code>N8N_DEBUG_OUTPUT</code> to see raw payloads.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Cleanup</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Stale temp files can fill <code>/tmp</code>; set <code>N8N_TMP_DIR</code> to a larger volume on production.</td>
</tr>
</tbody>
</table>
<h3 style="margin-bottom: 45px; line-height: 1.3;">Execution Path (text diagram)</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">[Webhook/Trigger] → Main Process → Scheduler → ├─► Worker (if heavy)
│
└─► Sandbox (if custom code)
↓
Result Aggregator → DB / Response
</pre>
<hr style="margin: 55px 0;" />
<h2 style="margin-bottom: 45px; line-height: 1.3;">2. The Main Process – “Control Plane”</h2>
<p>If you encounter any <a href="/n8n-webhook-backpressure-explained">n8n webhook backpressure explained </a>resolve them before continuing with the setup.</p>
<p style="margin-bottom: 2em; line-height: 1.9;">The Main Process orchestrates everything that doesn’t need heavy lifting or isolation.</p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">2.1 What lives here?</h3>
<ul style="margin-bottom: 1.8em; line-height: 1.9;">
<li><strong>HTTP server</strong> (<code>express</code>) – receives webhooks and UI requests.</li>
<li><strong>Workflow registry</strong> – loads workflow JSON from the database.</li>
<li><strong>Execution graph builder</strong> – creates a DAG (directed acyclic graph).</li>
<li><strong>Lightweight nodes</strong> – e.g., <code>Set</code>, <code>Merge</code>, <code>IF</code>, <code>Switch</code> (no external I/O).</li>
</ul>
<h3 style="margin-bottom: 45px; line-height: 1.3;">2.2 Configuration knobs</h3>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Env Variable</th>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Default</th>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Effect</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">N8N_MAX_EXECUTION_TIME</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">3600 s</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Max wall‑clock time for a workflow before the main process aborts it.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">N8N_WORKER_CONCURRENCY</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">5</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Max concurrent workers; increase on multi‑core servers.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">N8N_DISABLE_WEBHOOKS</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">false</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Disables webhook listener (useful for batch‑only installations).</td>
</tr>
</tbody>
</table>
<p style="margin-bottom: 2em; line-height: 1.9;">On a VM with limited RAM, keep <code>N8N_MAX_EXECUTION_TIME</code> low (e.g., <code>300</code>) to avoid runaway loops exhausting main process memory.</p>
<hr style="margin: 55px 0;" />
<h2 style="margin-bottom: 45px; line-height: 1.3;">3. Worker Processes: The “Data Plane”</h2>
<p>If you encounter any <a href="/n8n-state-handling-between-nodes">n8n state handling between nodes </a>resolve them before continuing with the setup.</p>
<p style="margin-bottom: 2em; line-height: 1.9;">Workers handle anything that would otherwise block the main process.</p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">3.1 When does n8n spawn a worker?</h3>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Condition</th>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Example Nodes</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Node declares <code>executionMode: "main"</code> → stays in main.</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;"><code>Set</code>, <code>IF</code></td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Node declares <code>executionMode: "worker"</code> → off‑loaded.</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;"><code>HTTP Request</code>, <code>Google Sheets</code>, <code>AWS S3</code>, <code>Code</code> (custom JS)</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Node has <code>runInBackground: true</code> (e.g., long polling).</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;"><code>Webhook</code>, <code>Trigger</code> with <code>polling</code> mode</td>
</tr>
</tbody>
</table>
<h3 style="margin-bottom: 45px; line-height: 1.3;">3.2 Worker lifecycle</h3>
<ol style="margin-bottom: 1.8em; line-height: 1.9;">
<li>Fork a new Node.js child process (<code>worker.js</code>).</li>
<li>Bootstrap with shared config (<code>worker-config.json</code>).</li>
<li>Execute node’s <code>execute()</code> method.</li>
<li>Return result via IPC (inter‑process communication).</li>
<li>Terminate after <code>N8N_WORKER_TIMEOUT</code> (default 600 s) or on error.</li>
</ol>
<h3 style="margin-bottom: 45px; line-height: 1.3;">3.3 Debugging worker failures</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;"># View live worker logs (4‑5 lines)
tail -f ~/.n8n/worker.log
</pre>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;"># Restart the worker pool after a code update
docker exec -it n8n n8n restart-worker-pool
</pre>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Symptom</th>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Likely Cause</th>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Fix</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">EWORKEREXIT</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Worker crashed (segfault, OOM)</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Increase <code>N8N_WORKER_MEMORY_LIMIT</code> or shrink payload size.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">ETIMEOUT</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Node exceeded <code>N8N_WORKER_TIMEOUT</code></td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Optimize API calls, enable pagination, or raise timeout.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">ENOTFOUND (credential)</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Credential not loaded in sandbox</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Verify credential scope (<strong>global</strong> vs <strong>workflow</strong>) and re‑authenticate.</td>
</tr>
</tbody>
</table>
<p style="margin-bottom: 2em; line-height: 1.9;">Restarting the worker pool is usually faster than hunting for the exact node that crashed.</p>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>EEFA note</strong> – In containers, ensure the cgroup memory limit exceeds <code>N8N_WORKER_MEMORY_LIMIT</code>; otherwise the kernel will OOM‑kill the worker silently.</p>
<hr style="margin: 55px 0;" />
<h2 style="margin-bottom: 45px; line-height: 1.3;">4. Sandbox (VM2) – Secure Isolation</h2>
<p style="margin-bottom: 2em; line-height: 1.9;">The sandbox protects the host process from arbitrary user code.</p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">4.1 Purpose</h3>
<ul style="margin-bottom: 1.8em; line-height: 1.9;">
<li>Isolate <strong>user‑provided JavaScript</strong> (<code>Code</code> node) and <strong>credential decryption</strong>.</li>
<li>Prevent malicious code from touching the file system, network (unless whitelisted), or environment variables.</li>
</ul>
<h3 style="margin-bottom: 45px; line-height: 1.3;">4.2 How it works – VM2 setup</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">const { NodeVM } = require('vm2');
const vm = new NodeVM({
console: 'inherit',
sandbox: { $node },
require: {
external: true,
builtin: ['fs', 'path'], // whitelist if needed
root: "./node_modules"
},
timeout: 30000, // 30 s max execution
memoryLimit: process.env.N8N_SANDBOX_MEMORY_LIMIT || 150
});
</pre>
<h3 style="margin-bottom: 45px; line-height: 1.3;">4.3 Running a user script</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">const userScript = `
module.exports = async function() {
return $node["input"];
};
`;
module.exports = vm.run(userScript);
</pre>
<h3 style="margin-bottom: 45px; line-height: 1.3;">4.4 Common pitfalls</h3>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Issue</th>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Symptoms</th>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Resolution</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Memory exceeded</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;"><code>RangeError: Invalid array length</code> inside Code node</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Raise <code>N8N_SANDBOX_MEMORY_LIMIT</code> (cautiously) or refactor to stream data.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Missing module</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;"><code>Error: Cannot find module 'axios'</code></td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Add the module to the **allowed external list** in VM2 config or install it globally (<code>npm i axios</code>).</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Infinite loop</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Execution hangs > 30 s, worker killed</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Reduce <code>timeout</code> to a lower value for safety, or break loop into chunked iterations.</td>
</tr>
</tbody>
</table>
<p style="margin-bottom: 2em; line-height: 1.9;">Do <strong>not</strong> disable sandboxing (<code>N8N_DISABLE_SANDBOX=true</code>) in production; it opens the host to arbitrary code execution.</p>
<hr style="margin: 55px 0;" />
<h2 style="margin-bottom: 45px; line-height: 1.3;">5. Scaling the Execution Engine</h2>
<p style="margin-bottom: 2em; line-height: 1.9;">Different strategies for handling growth.</p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">5.1 Horizontal scaling (multiple n8n instances)</h3>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Component</th>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Scaling Strategy</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Webhook listener</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Use a load balancer (NGINX, Traefik) with sticky sessions; set <code>N8N_ENDPOINT_WEBHOOK</code> to a shared domain.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Worker pool</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Deploy a **Redis‑backed queue** (<code>bullmq</code>) via <code>N8N_WORKER_QUEUE=redis://redis:6379</code> to share jobs across instances.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Database</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Centralize on PostgreSQL or MySQL; configure <code>DB_TYPE</code>, <code>DB_POSTGRESDB_DATABASE</code>, etc.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Cache</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Enable <code>N8N_CACHE=true</code> with Redis to avoid duplicate credential decryption.</td>
</tr>
</tbody>
</table>
<p style="margin-bottom: 2em; line-height: 1.9;">The table shows which pieces benefit from load‑balanced or shared resources.</p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">5.2 Vertical scaling (single instance)</h3>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Resource</th>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Recommended Setting</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">CPU cores</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;"><code>N8N_WORKER_CONCURRENCY = #cores * 2</code> (e.g., 8 cores → 16 workers).</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">RAM</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Allocate at least **2 GB per 5 concurrent workers**.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Disk I/O</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Use SSD for <code>/tmp</code> and DB storage; set <code>N8N_TMP_DIR</code> to a high‑throughput mount.</td>
</tr>
</tbody>
</table>
<p style="margin-bottom: 2em; line-height: 1.9;">**EEFA production checklist**</p>
<ul style="margin-bottom: 1.8em; line-height: 1.9;">
<li><code>N8N_LOG_LEVEL=error</code> (avoid verbose logs).</li>
<li>Enable process monitoring (PM2, systemd) with auto‑restart on crash.</li>
<li>Set resource limits (<code>ulimit -n 4096</code>, <code>--max-old-space-size=1024</code>).</li>
<li>Rotate <code>worker.log</code> daily (<code>logrotate</code> config).</li>
<li>Harden sandbox: whitelist only needed built‑ins, disable <code>eval</code>.</li>
</ul>
<hr style="margin: 55px 0;" />
<h2 style="margin-bottom: 45px; line-height: 1.3;">6. Troubleshooting “What Runs Where” Issues</h2>
<p style="margin-bottom: 2em; line-height: 1.9;">Targeted steps for common pain points.</p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">6.1 Symptom: Data missing after a <code>Code</code> node</h3>
<ol style="margin-bottom: 1.8em; line-height: 1.9;">
<li>Open the execution log and locate the node ID (e.g., <code>Node 12</code>).</li>
<li>Check sandbox logs (<code>~/.n8n/sandbox.log</code>).</li>
<li>If you see <code>RangeError: Invalid array length</code>, the script exceeded the sandbox memory limit.</li>
</ol>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Fix</strong> – increase the memory limit and restart n8n:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">export N8N_SANDBOX_MEMORY_LIMIT=300 # 300 MB
docker restart n8n
</pre>
<h3 style="margin-bottom: 45px; line-height: 1.3;">6.2 Symptom: “Webhook not received” on cloud deployment</h3>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Likely place</th>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Why</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Main Process</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Listener bound to <code>localhost</code> instead of public IP (<code>N8N_HOST=0.0.0.0</code>).</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Load balancer</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Health‑check path not whitelisted, causing 502.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Worker</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Worker crashed before the webhook could be acknowledged (<code>EWORKEREXIT</code>).</td>
</tr>
</tbody>
</table>
<p style="margin-bottom: 2em; line-height: 1.9;">**Resolution** – ensure the host binds to all interfaces and verify the LB health check:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">export N8N_HOST=0.0.0.0
curl -I http://your-n8n.example.com/webhook-test
</pre>
<h3 style="margin-bottom: 45px; line-height: 1.3;">6.3 Symptom: “Credential not found” in a <code>Google Sheets</code> node</h3>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Check</th>
<th style="padding: 13px; border: 1px solid #e0e0e0; text-align: left;">Action</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Credential scope</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Confirm the credential is <strong>global</strong> or attached to the workflow (<strong>Credentials → Scope</strong>).</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Sandbox isolation</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">If a <code>Code</code> node fetches a token, ensure you call <code>$credentials["googleSheets"]</code> inside the sandbox.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Worker cache</td>
<td style="padding: 13px; border: 1px solid #e0e0e0;">Stale cache can cause misses; restart the worker pool.</td>
</tr>
</tbody>
</table>
<p style="margin-bottom: 2em; line-height: 1.9;">Restart the worker pool:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">docker exec -it n8n n8n restart-worker-pool
</pre>
<hr style="margin: 55px 0;" />
<h2 style="margin-bottom: 45px; line-height: 1.3;">Conclusion</h2>
<ul style="margin-bottom: 1.8em; line-height: 1.9;">
<li><strong>Main Process</strong> – triggers, lightweight nodes, orchestration.</li>
<li><strong>Worker Process</strong> – heavy I/O or CPU‑intensive nodes in child processes.</li>
<li><strong>Sandbox</strong> – isolates custom JavaScript and credential decryption via VM2.</li>
<li>Identify the problematic context, tweak the relevant environment variables, and restart the affected component (main, worker, or sandbox).</li>
</ul>
<p style="margin-bottom: 2em; line-height: 1.9;">All examples assume a Unix‑like environment; adapt paths and service names for Windows or Docker‑Compose setups.</p>
Step by Step Guide to solve inside n8n execution engine
Who this is for: developers and DevOps engineers who run n8n in production and need to pinpoint why a step misbehaves (missing data, time‑outs, permission errors, etc.). We cover this in detail in the n8n Architectural Failure Modes Guide.
Quick Diagnosis
If a workflow behaves oddly, first locate where the offending code runs—Main Process, Worker Process, or Sandbox—and adjust node settings, credentials, or deployment limits for that context; the problem often disappears.
In production this often shows up as a missing field or a timeout after a few minutes of execution.
Featured‑snippet answer – n8n routes each workflow step to one of three runtimes:
Main Process – UI, webhook listeners, and lightweight nodes.
Worker Process – CPU‑intensive or long‑running nodes in a separate child process.
Sandbox – Isolated execution of custom JavaScript and credential decryption.
The engine decides based on node type, sync/async mode, and available resources.