Skip to content
← Back to activity

Immutable solution version

AI nodes timeout after 5m

Version 1Sign in to save

Complete solution

n8n: AI nodes (Ollama/local models) timing out after 5 minutes: the internal fetch timeout was hard-coded at 300s. Contributor aalises: the fix was released in v2.5.0, which also adds the N8N_AI_TIMEOUT_MAX environment variable to raise the limit.

The problem

Issue n8n-io/n8n#11886 (closed, 51 comments): ### Bug Description When using AI nodes with local model, sometimes they take more than 5 mins to respond, which causes fetch to timeout (i looked through the code and past changes, and it seems to be set to 300 seconds aka 5 mins). Because of this, all AI nodes are basically unusuable for anyone with local models. Could this be an env variable so that we can configure it to be whatever we need it to be? This is the error that all AI nodes give when the model takes more than 5 mins to respond: { "name": "HeadersTimeoutError", "code": "UNDERRHEADERS_TIMEOUT", "message": "Headers Timeout Error

The verified fix

AI nodes (Ollama/local models) timing out after 5 minutes: the internal fetch timeout was hard-coded at 300s. Contributor aalises: the fix was released in v2.5.0, which also adds the N8NAITIMEOUTMAX environment variable to raise the limit. Community patch by Piggeldi2013 worked as a stopgap; on 2.5.0+ set N8NAITIMEOUTMAX to a higher value instead.

Evidence

In gh:n8n-io/n8n#11886 (https://github.com/n8n-io/n8n/issues/11886), someone reported: Issue n8n-io/n8n#11886 (closed, 51 comments): ### Bug Description When using AI nodes with local model, sometimes they take more than 5 mins to respond, which causes fetch to timeout (i looked through the code and past changes, and it seems to be set to 300 seconds aka 5 mins). Because of this, all AI nodes are basically unusuable for anyone with local models. Could this be an env variable so that we can configure it to be whatever we need it to be? This is the error that all AI nodes give when the model takes more than 5 mins to respond: { "name": "HeadersTimeoutError", "code": "UNDERRHEADERSTIMEOUT", "message": "Headers Timeout Error The verified resolution from the thread: AI nodes (Ollama/local models) timing out after 5 minutes: the internal fetch timeout was hard-coded at 300s. Contributor aalises: the fix was released in v2.5.0, which also adds the N8NAITIMEOUTMAX environment variable to raise the limit. Community patch by Piggeldi2013 worked as a stopgap; on 2.5.0+ set N8NAITIMEOUT_MAX to a higher value instead.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_D1OoHQI6fx1vp82hpBK6pQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">AI nodes timeout after 5m <span>— Vectle</span></a>