Skip to content

Task Runner in n8n 2.0.2 (and other n8n 2 beta versions) ignores N8N_RUNNERS_STDLIB_ALLOW=* and blocks ALL imports (stdlib & external) #23175

Description

@Linux-bootloader

Bug Description

Summary

When running n8n v2.0.2 with an external Task Runner (n8nio/runners:latest), the Python Code node throws import errors for every type of import, even when explicit allow rules are configured to permit everything.

Example error:

Import of standard library module '<package>' is disallowed. Allowed stdlib modules: none

This occurs for:

  • Standard library modules (e.g., json, os, subprocess)
  • External modules (even when installed in the runner container)
  • ANY import statement — nothing is allowed

Even with:

N8N_RUNNERS_STDLIB_ALLOW=*
N8N_RUNNERS_EXTERNAL_ALLOW=*

…the Task Runner treats the allowed lists as empty.

This makes Python Code nodes essentially unusable when using the external Task Runner.

To Reproduce

Steps to Reproduce

1. docker-compose.yml:

services:
  n8n:
    image: n8nio/n8n:2.0.2
    env_file:
      - .env
    container_name: n8n
    ports:
      - "81:443"
      - "5679:5679"
      - "587:587"
    volumes:
      - n8n_data:/home/node/.n8n
    environment:
      N8N_RUNNERS_AUTH_TOKEN: ${N8N_RUNNERS_AUTH_TOKEN}
      N8N_RUNNERS_BROKER_LISTEN_ADDRESS: ${N8N_RUNNERS_BROKER_LISTEN_ADDRESS}
      N8N_RUNNERS_MODE: ${N8N_RUNNERS_MODE}
      N8N_RUNNERS_ENABLED: ${N8N_RUNNERS_ENABLED}
      N8N_NATIVE_PYTHON_RUNNER: ${N8N_NATIVE_PYTHON_RUNNER}
    restart: always

  task-runners:
    image: n8nio/runners:latest
    env_file:
      - .env
    container_name: n8n-task-runner
    depends_on:
      - n8n
    environment:
      N8N_RUNNERS_TASK_BROKER_URI: ${RUNNERS_TASK_BROKER_URI}
      N8N_RUNNERS_AUTH_TOKEN: ${RUNNERS_AUTH_TOKEN}
      N8N_RUNNERS_AUTO_SHUTDOWN_TIMEOUT: ${N8N_RUNNERS_AUTO_SHUTDOWN_TIMEOUT}
      N8N_RUNNERS_STDLIB_ALLOW: ${N8N_RUNNERS_STDLIB_ALLOW}
      N8N_RUNNERS_EXTERNAL_ALLOW: ${N8N_RUNNERS_EXTERNAL_ALLOW}
    restart: unless-stopped

2. .env file:

N8N_RUNNERS_ENABLED=true
N8N_RUNNERS_MODE=external
N8N_RUNNERS_BROKER_LISTEN_ADDRESS=0.0.0.0
N8N_RUNNERS_AUTH_TOKEN=pass
N8N_NATIVE_PYTHON_RUNNER=true

RUNNERS_TASK_BROKER_URI=http://n8n:5679
RUNNERS_AUTH_TOKEN=pass
N8N_RUNNERS_AUTO_SHUTDOWN_TIMEOUT=15

N8N_RUNNERS_STDLIB_ALLOW=*
N8N_RUNNERS_EXTERNAL_ALLOW=*

3. In a Python Code node:

import json
return {"ok": True}

4. Run the workflow.

Expected behavior

Expected Behaviour

Given:

N8N_RUNNERS_STDLIB_ALLOW=*
N8N_RUNNERS_EXTERNAL_ALLOW=*

…the Python Runner should allow:

  • All standard library modules
  • All Python packages installed in the image
  • Typical imports used for file I/O, subprocess, API integrations, data parsing, etc.

Actual Behavior

Every import statement fails, including json, the most basic stdlib module.

Example:

Import of standard library module 'json' is disallowed. Allowed stdlib modules: none

Same happens for ANY other module — stdlib or external.

The allow lists behave as if they were completely empty, even when configured to allow everything (*).

Debug Info

Debug info

core

  • n8nVersion: 2.0.2
  • platform: docker (self-hosted)
  • nodeJsVersion: 22.21.0
  • nodeEnv: production
  • database: sqlite
  • executionMode: regular
  • concurrency: -1
  • license: enterprise (production)
  • consumerId: c2cb5070-7bcf-4796-b058-0b50ec6940b0

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 (x11; cros x86_64 14541.0.0) applewebkit/537.36 (khtml, like gecko) chrome/142.0.0.0 safari/537.36
  • isTouchDevice: false

Generated at: 2025-12-13T10:34:24.702Z

Operating System

Debain Linux

n8n Version

2.0.2

Node.js Version

22.21.0

Database

SQLite (default)

Execution mode

main (default)

Hosting

self hosted

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions