n8n - 💡(How to fix) Fix Code node hangs with AI Agent HTTP Request Tool present [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

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#30358Fetched 2026-05-14 03:45:30
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
commented ×1labeled ×1mentioned ×1subscribed ×1

Error Message

Describe the problem/error/question

What is the error message?

Error: Task execution timed out after 300 seconds Status: Error

  • error: all

Root Cause

This appears similar to #20132, but in this case the workflow is an active production-style Chatwoot webhook workflow using an AI Agent with a RAG/knowledge-base HTTP tool. The tool is required because the model needs to dynamically query the knowledge base during agent reasoning.

RAW_BUFFERClick to expand / collapse

Bug Description

Describe the problem/error/question

In a self-hosted n8n workflow, a normal Code node times out after exactly 300 seconds when the workflow contains an AI Agent with an HTTP Request Tool.

The Code node itself is very simple and only does object lookup/routing. It does not perform network requests, loops, or long-running work. It should complete in milliseconds.

However, when an AI Agent node with an HTTP Request Tool exists in the same workflow, the Code node fails with:

Task execution timed out after 300 seconds

This appears similar to #20132, but in this case the workflow is an active production-style Chatwoot webhook workflow using an AI Agent with a RAG/knowledge-base HTTP tool. The tool is required because the model needs to dynamically query the knowledge base during agent reasoning.

What is the error message?

Task execution timed out after 300 seconds

The task runner was taking too long on this task, so it was suspected of being unresponsive and restarted, and the task was aborted.

Stack trace:
Error: Task execution timed out after 300 seconds
    at TaskBroker.handleTaskTimeout (/usr/local/lib/node_modules/n8n/src/task-runners/task-broker/task-broker.service.ts:504:4)
    at Timeout.<anonymous> (/usr/local/lib/node_modules/n8n/src/task-runners/task-broker/task-broker.service.ts:476:15)
    at listOnTimeout (node:internal/timers:605:17)
    at processTimers (node:internal/timers:541:7)

Actual behavior
The Code node times out after 300 seconds.

Execution details:

Status: Error
Duration: 5m 0.131s
Failed node: Product Router
n8n version: 2.19.5 Self Hosted
The input item is small, for example:

{
  "data": {
    "inbox_id": 1,
    "inbox_title": "development",
    "conv_id": 385,
    "message_id": 6549,
    "message_content": "<p>Hello</p>",
    "message_type": "incoming",
    "account_id": 2,
    "content_type": "text",
    "event": "message_created"
  }
}
Expected behavior
The Code node should finish immediately. The presence of an AI Agent / HTTP Request Tool elsewhere in the workflow should not cause unrelated Code nodes to hang or hit the task runner timeout.

Workflow structure
Simplified structure:

Webhook
-> Config (Code)
-> Set / Normalize webhook data
-> Product Router (Code)  <-- times out here
-> IF
-> Load conversation history
-> Process history (Code)
-> AI Agent
   ├─ Chat Model
   └─ HTTP Request Tool for knowledge base / RAG
-> downstream nodes
The HTTP Request Tool is used as a knowledge-base / RAG tool. It cannot simply be replaced by a single main-flow HTTP Request node, because the AI Agent needs to decide dynamically when and how many times to query the knowledge base.

### To Reproduce

The issue seems tied to the combination of:

Self-hosted n8n
Task runners enabled
Code node
AI Agent node
HTTP Request Tool connected to or present for the AI Agent
Removing the AI Tool or avoiding Code nodes appears to avoid the timeout.

Environment
n8n version: 2.19.5
Deployment: Self Hosted
Task runners: enabled
Execution type: webhook workflow
Why this seems like an n8n runtime/task-runner issue
The failing Code node contains no async work, no external HTTP calls, and no loop. The stack trace points to TaskBroker.handleTaskTimeout, and the failure happens exactly at the default task runner timeout of 300 seconds.

This suggests the task runner or workflow initialization/AI Tool handling is hanging or blocking execution, rather than the Code node itself taking 300 seconds.

### Expected behavior

The Code node should finish immediately. The presence of an AI Agent / HTTP Request Tool elsewhere in the workflow should not cause unrelated Code nodes to hang or hit the task runner timeout.

### Debug Info

# Debug info

## core

- n8nVersion: 2.19.5
- platform: docker (self-hosted)
- nodeJsVersion: 24.14.1
- nodeEnv: production
- database: postgres
- executionMode: regular
- concurrency: -1
- license: enterprise (production)
- consumerId: c56f5a81-3ec7-461b-949e-175e357cd4ab

## storage

- success: all
- error: all
- progress: false
- manual: true
- binaryMode: filesystem

## pruning

- enabled: true
- maxAge: 336 hours
- maxCount: 10000 executions

## client

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

Generated at: 2026-05-13T04:38:47.861Z

### Operating System

NAME="OpenCloudOS" VERSION="9.2" ID="opencloudos" ID_LIKE="opencloudos" VERSION_ID="9.2" PLATFORM_ID="platform:oc9" PRETTY_NAME="OpenCloudOS 9.2" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:opencloudos:opencloudos:9" HOME_URL="https://www.opencloudos.org/" BUG_REPORT_URL="https://bugs.opencloudos.tech/"

### n8n Version

2.19.5

### 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 Code node should finish immediately. The presence of an AI Agent / HTTP Request Tool elsewhere in the workflow should not cause unrelated Code nodes to hang or hit the task runner timeout.

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 Code node hangs with AI Agent HTTP Request Tool present [1 comments, 2 participants]