n8n - 💡(How to fix) Fix `N8N_AI_TIMEOUT_MAX` is silently ignored when no HTTP proxy is configured [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
n8n-io/n8n#30420Fetched 2026-05-14 03:45:18
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
closed ×1commented ×1labeled ×1mentioned ×1

Error Message

  • error: all

Root Cause

The call should respect N8N_AI_TIMEOUT_MAX and run up to the configured ceiling (1,200,000 ms in this reproduction). Instead, undici's default 300s timeout silently overrides it because getProxyAgent(targetUrl) returns undefined when no proxy is configured AND no timeoutOptions arg is passed by the caller — and every lmChat* node currently calls it that way. DEFAULT_TIMEOUT is computed from process.env.N8N_AI_TIMEOUT_MAX on line 18 of packages/@n8n/ai-utilities/src/utils/http-proxy-agent.ts but is only consumed when the function actually constructs an Agent.

RAW_BUFFERClick to expand / collapse

Bug Description

The N8N_AI_TIMEOUT_MAX environment variable is documented as the configurable ceiling for LLM HTTP timeouts on AI nodes. In practice it has no effect for the most common deployment shape (no outbound proxy). All lmChat* nodes that call getProxyAgent(targetUrl) without a second timeoutOptions argument fall through to undici's default Agent, which has a headersTimeout / bodyTimeout of 300 seconds. Long-running calls (e.g. Opus with high thinking budgets and large prompts) abort at exactly 5 minutes regardless of how N8N_AI_TIMEOUT_MAX is set.

To Reproduce

  1. Deploy n8n without setting HTTP_PROXY / HTTPS_PROXY.
  2. Set N8N_AI_TIMEOUT_MAX=1200000 (20 min) in the n8n env.
  3. Build a workflow with @n8n/n8n-nodes-langchain.lmChatAnthropic + AI Agent.
  4. Send a prompt that takes > 300s end-to-end (e.g. Opus 4.6 with thinkingBudget: 17000 + ~70K input tokens).
  5. Observed: call aborts at ~300s with a fetch/undici timeout.
  6. Expected: call respects N8N_AI_TIMEOUT_MAX and runs up to 1200s.

Expected behavior

The call should respect N8N_AI_TIMEOUT_MAX and run up to the configured ceiling (1,200,000 ms in this reproduction). Instead, undici's default 300s timeout silently overrides it because getProxyAgent(targetUrl) returns undefined when no proxy is configured AND no timeoutOptions arg is passed by the caller — and every lmChat* node currently calls it that way. DEFAULT_TIMEOUT is computed from process.env.N8N_AI_TIMEOUT_MAX on line 18 of packages/@n8n/ai-utilities/src/utils/http-proxy-agent.ts but is only consumed when the function actually constructs an Agent.

Debug Info

Debug info

core

  • n8nVersion: 2.20.6
  • platform: docker (self-hosted)
  • nodeJsVersion: 24.14.1
  • nodeEnv: production
  • database: postgres
  • executionMode: regular
  • concurrency: -1
  • license: enterprise (production)
  • consumerId: b732ee02-7882-42f0-a190-84533f4af2f3

storage

  • success: all
  • error: all
  • progress: false
  • manual: true
  • binaryMode: memory

pruning

  • enabled: true
  • maxAge: 168 hours
  • maxCount: 10000 executions

client

  • userAgent: mozilla/5.0 (macintosh; intel mac os x 10_15_7) applewebkit/537.36 (khtml, like gecko) chrome/146.0.0.0 safari/537.36
  • isTouchDevice: false

cluster

  • instanceCount: 1
  • versions: 2.20.6
  • instances:
    • instanceKey: b0567ad5-8df1-43b3-93cf-0d426fade4a5, hostId: main-n8n-84b7bf74db-ddzzv, instanceType: main, instanceRole: leader, version: 2.20.6
  • checks:
    • check: hostid-clash, status: succeeded, warnings: -
    • check: lifecycle, status: succeeded, warnings: -
    • check: split-brain, status: succeeded, warnings: -
    • check: version-mismatch, status: succeeded, warnings: -

Generated at: 2026-05-13T17:17:41.622Z

Operating System

Alpine Linux 3.x (n8n Docker image base) on AWS EKS

n8n Version

2.20.6

Node.js Version

24.14.1

Database

PostgreSQL

Execution mode

main (default)

Hosting

self hosted

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The call should respect N8N_AI_TIMEOUT_MAX and run up to the configured ceiling (1,200,000 ms in this reproduction). Instead, undici's default 300s timeout silently overrides it because getProxyAgent(targetUrl) returns undefined when no proxy is configured AND no timeoutOptions arg is passed by the caller — and every lmChat* node currently calls it that way. DEFAULT_TIMEOUT is computed from process.env.N8N_AI_TIMEOUT_MAX on line 18 of packages/@n8n/ai-utilities/src/utils/http-proxy-agent.ts but is only consumed when the function actually constructs an Agent.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

n8n - 💡(How to fix) Fix `N8N_AI_TIMEOUT_MAX` is silently ignored when no HTTP proxy is configured [1 comments, 2 participants]