## 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": "UND_ERR_HEADERS_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 N8N_AI_TIMEOUT_MAX environment variable to raise the limit. Community patch by Piggeldi2013 worked as a stopgap; on 2.5.0+ set N8N_AI_TIMEOUT_MAX to a higher value instead.