Code node task was not matched to a runner within the timeout period

Describe the problem/error/question

I run docker stack with n8n, n8n-worker, postgresdb and redis. It was all fine until i upgraded to 2.0.3. I have added n8n-runner as its needed for code node.
After upgrade of n8n to 2.0.3 with task runners implemented, i get “Code node task was not matched to a runner within the timeout period” for code node for both python and javascript.

What is the error message (if any)?

Task request timed out after 60 seconds

Your Code node task was not matched to a runner within the timeout period. This indicates that the task runner is currently down, or not ready, or at capacity, so it cannot service your task.

If you are repeatedly executing Code nodes with long-running tasks across your instance, please space them apart to give the runner time to catch up. If this does not describe your use case, please open a GitHub issue or reach out to support.

If needed, you can increase the timeout using the N8N_RUNNERS_TASK_REQUEST_TIMEOUT environment variable.

Error: Task request timed out after 60 seconds at LocalTaskRequester.requestExpired (/usr/local/lib/node_modules/n8n/src/task-runners/task-managers/task-requester.ts:304:17) at LocalTaskRequester.onMessage (/usr/local/lib/node_modules/n8n/src/task-runners/task-managers/task-requester.ts:272:10) at TaskBroker.handleRequestTimeout (/usr/local/lib/node_modules/n8n/src/task-runners/task-broker/task-broker.service.ts:115:50) at Timeout.<anonymous> (/usr/local/lib/node_modules/n8n/src/task-runners/task-broker/task-broker.service.ts:102:9) at listOnTimeout (node:internal/timers:588:17) at processTimers (node:internal/timers:523:7)

Information on your n8n setup

  • n8n version: 2.0.3
  • Database (default: SQLite): postgresdb
  • **n8n EXECUTIONS_PROCESS setting (default: own, main): **
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker swarm stack
  • Operating system: Ubuntu
  • Here is my docker-compose.yml
version: '3.8'

services:
  postgres:
    image: postgres:16
    restart: always
    networks:
      - traefik_web
    environment:
      - POSTGRES_USER=xxxxx
      - POSTGRES_PASSWORD=yyyyyyyy
      - POSTGRES_DB=n8n
    volumes:
      - /opt/nfs/n8n_db:/var/lib/postgresql/data
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}']
      interval: 5s
      timeout: 5s
      retries: 10

  redis:
    image: redis:6-alpine
    restart: always
    networks:
      - traefik_web
    volumes:
      - /opt/nfs/n8n_redis:/data
    healthcheck:
      test: ['CMD', 'redis-cli', 'ping']
      interval: 5s
      timeout: 5s
      retries: 10

  n8n:
    restart: always
    image: n8nio/n8n:2.0.3
    container_name: n8n
    environment:
      # --- Database Connection Settings ---
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=n8n
      - DB_POSTGRESDB_USER=xxxxx
      - DB_POSTGRESDB_PASSWORD=yyyyyyyy

      # --- General Settings ---
      - EXECUTIONS_MODE=queue
      - N8N_ENCRYPTION_KEY=5QMMhD6hAvy6usEk
      - OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS=true
      - N8N_SECURE_COOKIE=false
      - NODES_EXCLUDE="[]"
      - N8N_METRICS=true

      # --- Logging ---
      - N8N_LOG_LEVEL=debug
      - N8N_LOG_OUTPUT=console,file
      - N8N_LOG_FILE_LOCATION=/home/node/.n8n/logs/n8n.log
      - N8N_LOG_FILE_SIZE_MAX=50

      # --- Redis Settings ---
      - QUEUE_BULL_REDIS_HOST=redis
      - QUEUE_HEALTH_CHECK_ACTIVE=true

      # --- Runner Config ---
      - N8N_RUNNERS_ENABLED=true
      - N8N_RUNNERS_MODE=external
      - N8N_RUNNERS_BROKER_LISTEN_ADDRESS=0.0.0.0
      - N8N_RUNNERS_AUTH_TOKEN=X5tP9qR3F8jX0
      - N8N_NATIVE_PYTHON_RUNNER=true
    links:
      - postgres
      - redis
    volumes:
      - /opt/nfs/n8n:/home/node/.n8n
      - /opt/nfs/n8n_app_data:/data
    ports:
      - 5678:5678
    networks:
      - traefik_web

  n8n-runner:
    image: n8nio/runners:2.0.3
    container_name: n8n-runner
    environment:
      - N8N_RUNNERS_TASK_BROKER_URI=http://n8n:5679
      - N8N_RUNNERS_AUTH_TOKEN=X5tP9qR3F8jX0
      # --- Logging ---
      - N8N_LOG_LEVEL=debug
      - N8N_LOG_OUTPUT=console,file
      - N8N_LOG_FILE_LOCATION=/home/node/.n8n/logs/n8n.log
      - N8N_LOG_FILE_SIZE_MAX=50
    depends_on:
      - n8n
    networks:
      - traefik_web

  n8n-worker:
    restart: always
    image: n8nio/n8n:2.0.3
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=n8n
      - DB_POSTGRESDB_USER=xxxxx
      - DB_POSTGRESDB_PASSWORD=yyyyyyyy
      # --- General Settings ---
      - GENERIC_TIMEZONE=Europe/Amsterdam
      - TZ=Europe/Amsterdam
      - EXECUTIONS_MODE=queue
      - QUEUE_BULL_REDIS_HOST=redis
      - QUEUE_HEALTH_CHECK_ACTIVE=true
      - N8N_ENCRYPTION_KEY=5QMMhD6hAvy6usEk
      # --- Runner Config ---
      - N8N_RUNNERS_ENABLED=true
      - N8N_RUNNERS_MODE=external
      - N8N_RUNNERS_BROKER_LISTEN_ADDRESS=0.0.0.0
      - N8N_RUNNERS_AUTH_TOKEN=X5tP9qR3F8jX0
      - N8N_NATIVE_PYTHON_RUNNER=true
      # --- Logging ---
      - N8N_LOG_LEVEL=debug
      - N8N_LOG_OUTPUT=console,file
      - N8N_LOG_FILE_LOCATION=/home/node/.n8n/logs/n8n.log
      - N8N_LOG_FILE_SIZE_MAX=50
    links:
      - postgres
      - redis
    volumes:
      - /opt/nfs/n8n:/home/node/.n8n
    command: worker
    networks:
      - traefik_web

networks:
  traefik_web:
    external: true

Since you are running in queue mode and offloading manual executions to workers, I think you need the broker URI to be http://n8n-worker:5679 as the n8n instance won’t be handling any workflow requests directly

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.