Set workflow timeouts in n8n by opening Workflow Settings and entering a value in the Timeout Workflow After field in seconds. You can also set per-node timeouts in individual node settings. Timeouts prevent long-running workflows from consuming resources indefinitely, which is critical for production deployments handling API calls or large data processing.
Why Set Timeouts for n8n Workflows
Without a timeout, a workflow that calls an unresponsive API or processes a massive dataset can run forever, consuming server resources and blocking other executions. Timeouts act as a safety net by automatically stopping workflows that exceed a specified duration. This is especially important in production environments where multiple workflows run concurrently. n8n supports two levels of timeout: workflow-level (applies to the entire execution) and node-level (applies to a single node). Combining both gives you precise control over execution limits.
Prerequisites
- A running n8n instance (self-hosted or n8n Cloud)
- At least one workflow you want to protect with a timeout
- For global timeout settings: access to server environment variables
Step-by-step guide
Open Workflow Settings
Open Workflow Settings
In the n8n editor, open the workflow you want to configure. Click the three-dot menu or the Settings gear icon for the workflow (not the global settings). This opens the Workflow Settings panel where you can configure execution behavior including timeouts, error handling, and save settings. The timeout setting is in the Timeout section of this panel.
Expected result: The Workflow Settings panel is open, showing configuration options including the Timeout Workflow After field.
Set the workflow timeout value
Set the workflow timeout value
In the Workflow Settings panel, find the Timeout Workflow After field. Enter a value in seconds. For example, enter 300 for a 5-minute timeout or 3600 for a 1-hour timeout. When the workflow execution exceeds this duration, n8n automatically stops it and marks it as failed with a timeout error. Choose a timeout value that is longer than the workflow's normal execution time but short enough to catch genuine hangs.
1// Workflow timeout examples (values in seconds)2// 60 = 1 minute (for quick API calls)3// 300 = 5 minutes (for moderate data processing)4// 900 = 15 minutes (for large data imports)5// 3600 = 1 hour (for batch processing jobs)6// 7200 = 2 hours (for heavy ETL workflows)Expected result: The workflow has a timeout configured. If execution exceeds the specified duration, n8n stops it automatically.
Set per-node timeouts
Set per-node timeouts
Individual nodes can have their own timeouts, independent of the workflow-level timeout. This is useful when one node in your workflow makes a slow API call while the rest completes quickly. Open the node settings, look for the Timeout field (usually under the Options or Settings section), and enter a value in seconds. The node timeout stops only that node, not the entire workflow. The workflow continues if error handling is configured.
1// Per-node timeout configuration2// Open any node → Settings tab → Timeout3//4// HTTP Request node:5// Settings → Timeout: 30 (seconds)6// This stops the HTTP request if the server does not respond within 30 seconds7//8// Code node:9// Settings → Timeout: 60 (seconds)10// This stops the code execution if it runs longer than 1 minuteExpected result: The individual node has its own timeout. If the node exceeds its timeout, it fails with a timeout error while the workflow can continue via error handling.
Set a global default timeout via environment variable
Set a global default timeout via environment variable
For self-hosted n8n instances, you can set a global default timeout that applies to all workflows. This acts as a safety net for workflows that do not have individual timeout settings. Set the EXECUTIONS_TIMEOUT environment variable to the maximum allowed execution time in seconds. You can also set EXECUTIONS_TIMEOUT_MAX to define the upper limit that individual workflow settings cannot exceed.
1# Set global timeout defaults (environment variables)23# Default timeout for all workflows: 1 hour4export EXECUTIONS_TIMEOUT=360056# Maximum allowed timeout (workflows cannot exceed this)7export EXECUTIONS_TIMEOUT_MAX=720089# Enable the timeout feature globally10export EXECUTIONS_TIMEOUT_ACTIVE=true1112# In docker-compose.yml:13# environment:14# - EXECUTIONS_TIMEOUT=360015# - EXECUTIONS_TIMEOUT_MAX=720016# - EXECUTIONS_TIMEOUT_ACTIVE=trueExpected result: All workflows have a default 1-hour timeout. Individual workflows can override this up to the 2-hour maximum.
Handle timeout errors gracefully
Handle timeout errors gracefully
When a workflow times out, it is marked as failed in the execution history. To handle timeouts gracefully, create an Error Trigger workflow that sends notifications when timeouts occur. You can also use the built-in error handling on individual nodes by enabling Continue On Fail, which lets the workflow continue even if a node times out. Combine this with an IF node to check for errors and take alternate actions.
1// Error handling pattern for timeout-prone nodes2// 1. Enable "Continue On Fail" on the node that might timeout3// 2. Add an IF node after it to check for errors45// IF node condition:6// Value 1: {{ $json.error }}7// Operation: is not empty8//9// True branch → Send error notification10// False branch → Continue normal processing1112// In a Code node, check for timeout:13const items = $input.all();14const results = items.map(item => {15 if (item.json.error) {16 return {17 json: {18 status: 'timeout',19 message: 'The operation timed out. Using cached data instead.',20 fallbackData: 'default value'21 }22 };23 }24 return item;25});26return results;Expected result: When a node times out, the workflow continues via the error handling path instead of failing completely.
Complete working example
1# docker-compose.yml — n8n with timeout configuration2version: '3.8'34services:5 n8n:6 image: docker.n8n.io/n8nio/n8n7 restart: unless-stopped8 ports:9 - '5678:5678'10 environment:11 # Timeout configuration12 - EXECUTIONS_TIMEOUT_ACTIVE=true13 - EXECUTIONS_TIMEOUT=360014 - EXECUTIONS_TIMEOUT_MAX=720015 # General settings16 - N8N_HOST=0.0.0.017 - N8N_PORT=567818 - WEBHOOK_URL=https://n8n.example.com/19 - GENERIC_TIMEZONE=America/New_York20 # Execution data retention21 - EXECUTIONS_DATA_SAVE_ON_SUCCESS=all22 - EXECUTIONS_DATA_SAVE_ON_ERROR=all23 - EXECUTIONS_DATA_PRUNE=true24 - EXECUTIONS_DATA_MAX_AGE=16825 # Logging26 - N8N_LOG_LEVEL=info27 volumes:28 - n8n_data:/home/node/.n8n29 healthcheck:30 test: ['CMD', 'wget', '--spider', '-q', 'http://localhost:5678/healthz']31 interval: 30s32 timeout: 5s33 retries: 33435volumes:36 n8n_data:37 driver: localCommon mistakes when setting Timeout for Workflows in n8n
Why it's a problem: Setting the timeout too short, causing workflows to fail during normal operation
How to avoid: Check the average execution time in the execution history. Set the timeout to at least 2-3 times the average to account for variability.
Why it's a problem: Not enabling EXECUTIONS_TIMEOUT_ACTIVE when setting EXECUTIONS_TIMEOUT
How to avoid: The timeout feature must be explicitly enabled. Set EXECUTIONS_TIMEOUT_ACTIVE=true in addition to setting the timeout value.
Why it's a problem: Confusing seconds with milliseconds when entering timeout values
How to avoid: n8n timeout values are in seconds, not milliseconds. A value of 300 means 5 minutes, not 0.3 seconds.
Why it's a problem: Not handling timeout errors, leaving the workflow in a failed state with no notification
How to avoid: Set up an Error Trigger workflow to send notifications when workflows fail due to timeouts.
Best practices
- Always set a global timeout with EXECUTIONS_TIMEOUT as a safety net for all workflows
- Use per-node timeouts for nodes that make external API calls or process large datasets
- Set workflow-level timeouts based on the expected execution time plus a generous buffer
- Enable Continue On Fail for timeout-prone nodes so the workflow can handle errors gracefully
- Monitor execution history to identify workflows that frequently approach their timeout limits
- Set EXECUTIONS_TIMEOUT_MAX to prevent users from setting unreasonably long timeouts
- Document the timeout value in workflow notes so team members understand the limit
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
My n8n workflow sometimes hangs indefinitely when calling an external API. How do I set a timeout at both the workflow level and the individual node level to prevent this?
Help me configure global timeout settings for my self-hosted n8n instance so that no workflow can run longer than 2 hours, with a default timeout of 30 minutes.
Frequently asked questions
What is the default timeout in n8n?
By default, n8n has no timeout — workflows can run indefinitely. You must explicitly enable timeouts by setting EXECUTIONS_TIMEOUT_ACTIVE=true and EXECUTIONS_TIMEOUT to a value in seconds.
Does the workflow timeout include waiting time for webhooks?
Yes. The workflow timeout starts when execution begins. If a Webhook node is waiting for a response, that waiting time counts toward the timeout.
Can I set different timeouts for different workflows?
Yes. Each workflow has its own Timeout Workflow After setting in Workflow Settings. This overrides the global default but cannot exceed EXECUTIONS_TIMEOUT_MAX.
What happens to the data when a workflow times out?
The execution is stopped and marked as failed in the execution history. Any data processed before the timeout is saved in the execution log. Data not yet written to external systems is lost.
Do node timeouts apply to built-in nodes like IF and Set?
Technically yes, but built-in nodes like IF and Set execute almost instantly. Node timeouts are most useful for HTTP Request, Code, and integration nodes that call external services.
Can RapidDev help me optimize slow n8n workflows?
Yes. RapidDev can analyze your n8n workflows, identify performance bottlenecks, and implement optimizations including proper timeout configuration and error handling. Contact RapidDev for a free consultation.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation