Skip to content

Task Runner: Workflow hangs and crash when Code node uses $node[] with AI Agent containing postgresTool sub-nodes #20752

Description

@sayedgamal99

Bug Description

When using task runners (internal or external), workflows hang and crash when all of the following conditions are met:

  1. Task runners are enabled in any mode
    (N8N_RUNNERS_ENABLED=true)
  2. A Code node tries to access previous node data using
    $node['nodeName'] syntax
  3. The workflow contains an AI Agent with specific tool nodes
    (e.g., postgresTool)

The workflow executes successfully when any one of these conditions is removed.

To Reproduce

Environment Setup

  • n8n version: 1.115.0
  • Database: PostgreSQL
  • Deployment: Self-hosted Docker with task runner sidecar container
  • Task Runner Mode: External
  • Task Runner Image: n8nio/runners:1.115.0

Docker Compose Configuration

services:
  n8n-prod:
    image: n8nio/n8n:1.115.0
    environment:
      - DB_TYPE=postgresdb
      - N8N_RUNNERS_ENABLED=true
      - N8N_RUNNERS_MODE=external
      - N8N_RUNNERS_BROKER_LISTEN_ADDRESS=0.0.0.0
      - N8N_RUNNERS_AUTH_TOKEN=<token>
      - N8N_SECURE_COOKIE=false
      - NODE_FUNCTION_ALLOW_BUILTIN=*
      - NODE_FUNCTION_ALLOW_EXTERNAL=*
      - N8N_BLOCK_ENV_ACCESS_IN_NODE=false
      - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
      - N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
      # ... other configs

  task-runners:
    image: n8nio/runners:1.115.0
    environment:
      - N8N_RUNNERS_TASK_BROKER_URI=http://n8n-prod:5679
      - N8N_RUNNERS_AUTH_TOKEN=<token>
      - N8N_RUNNERS_AUTO_SHUTDOWN_TIMEOUT=0

Workflow Structure

Chat Trigger
  → Chat Configs (Set node)
  → Validate Request (Code node) [works - no $node[] access]
  → Input Preparation (Code node) [HANGS HERE]
  → ... other nodes
  → AI Agent [with postgresTool in tools]
  → Response

Code That Triggers the Issue

In the "Input Preparation" Code node:

// This causes the workflow to hang
const chatConfig = $node['Chat Configs'].json;
// ... rest of code

Steps to Reproduce

  1. Enable task runners.

  2. Create a workflow with:

    • A Chat Trigger node
    • A Set/Code node that produces configuration data
    • A downstream Code node that references the previous node using $node['nodeName']
    • An AI Agent node with tool sub-nodes (e.g., postgresTool)
  3. Execute the workflow.

  4. Observe that execution hangs at the Code node with $node[] reference.

and here's a sample workflow that contain the actual issue:

workflow.json

Expected behavior

Expected Behavior

The Code node should successfully access previous node data using $node['nodeName'] syntax regardless of what other node types exist in the workflow.


Actual Behavior

  • The workflow execution hangs at the Code node.

  • The following error appears in logs:

    Unrecognized node type: n8n-nodes-base.postgresTool
    
  • The task runner eventually times out or crashes the workflow execution.


Log Output

2025-10-14 10:55:19 Registered runner "JS Task Runner" (e36iBilJnKh_Mgnvh70pV)
2025-10-14 10:55:20 Unrecognized node type: n8n-nodes-base.postgresTool

Debug Info

Debug info

core

  • n8nVersion: 1.115.0
  • platform: docker (self-hosted)
  • nodeJsVersion: 22.19.0
  • nodeEnv: production
  • database: postgres
  • executionMode: regular
  • concurrency: -1
  • license: enterprise (production)
  • consumerId: c3ac9ab3-afe8-4c83-8042-895ec5a6f980

storage

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

pruning

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

client

  • userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/141.0.0.0 safari/537.36
  • isTouchDevice: false

security

  • secureCookie: false

Generated at: 2025-10-14T09:17:10.553Z

Operating System

OS: Linux (Docker)

n8n Version

1.115.0

Node.js Version

v22.19.0

Database

PostgreSQL

Execution mode

main (default)

Hosting

self hosted

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions