# Problems with Python code node in n8n

**URL:** <https://community.n8n.io/t/problems-with-python-code-node-in-n8n/299547>\
**Category:** Questions\
**Tags:** workflow-building\
**Created:** [June 15, 2026, 12:56pm UTC](https://community.n8n.io/t/problems-with-python-code-node-in-n8n/299547 "2026-06-15T12:56:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Quent](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/quent/32/175176_2.png) [@Quent](https://community.n8n.io/u/Quent)\
**Post date:** [June 15, 2026, 12:56pm UTC](https://community.n8n.io/t/problems-with-python-code-node-in-n8n/299547/1 "2026-06-15T12:56:44Z")

</div>

Hello!  
I got the error in my n8n workflow on code node (I used python):  
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:124:50) at Timeout. (/usr/local/lib/node\_modules/n8n/src/task-runners/task-broker/task-broker.service.ts:110:9) at listOnTimeout (node:internal/timers:605:17) at processTimers (node:internal/timers:541:7)

My code:

```auto
snippet_text = _items[0]["json"]["snippet"]
return [{'json': {'snippet': snippet_text}}]

```

I launch n8n via docker compose.  
Here my docker compose config:

```auto

services:

  n8n:

    image: n8nio/n8n:latest

    container_name: n8n-main

    restart: always

    environment:

      - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=false

      - N8N_BLOCK_ENV_ACCESS_IN_NODE=false

      - N8N_HOST=://example.com

      - N8N_PORT=5678

      - WEBHOOK_URL=http://localhost:5678/

      - DB_TYPE=postgresdb

      - DB_POSTGRESDB_HOST=postgres

      - DB_POSTGRESDB_PORT=5432

      - DB_POSTGRESDB_DATABASE=n8n

      - DB_POSTGRESDB_USER=n8n_user

      - DB_POSTGRESDB_PASSWORD=your_postgres_password

      - N8N_RUNNERS_ENABLED=true

      - N8N_RUNNERS_MODE=external

      - N8N_RUNNERS_AUTH_TOKEN=super_secure_token_change_me

      - N8N_RUNNERS_BROKER_PORT=5679

      - N8N_RUNNERS_BROKER_LISTEN_ADDRESS=0.0.0.0

    ports:

      - "5678:5678"

      - "5679:5679"

    volumes:

      - n8n_data:/home/node/.n8n

    depends_on:

      postgres:

        condition: service_healthy

  n8n-runner:

    image: n8nio/runners:latest

    container_name: n8n-task-runner

    restart: always

    environment:

    - N8N_RUNNERS_ENABLED_MODES=python

      - N8N_RUNNERS_BROKER_URL=ws://n8n:5679

      - N8N_RUNNERS_AUTH_TOKEN=super_secure_token_change_me

    depends_on:

      - n8n

  postgres:

    image: postgres:15-alpine

    container_name: n8n-postgres

    restart: always

    environment:

      - POSTGRES_USER=n8n_user

      - POSTGRES_PASSWORD=your_postgres_password  

      - POSTGRES_DB=n8n

    volumes:

      - postgres_data:/var/lib/postgresql/data

    healthcheck:

      test: \["CMD-SHELL", "pg_isready -U n8n_user -d n8n"\]

      interval: 5s

      timeout: 5s

      retries: 5

volumes:

  n8n_data:

  postgres_data:

```

How I can fix that?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![nguyenthieutoan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/nguyenthieutoan/32/120924_2.png) [@nguyenthieutoan](https://community.n8n.io/u/nguyenthieutoan)\
**Post date:** [June 15, 2026, 1:01pm UTC](https://community.n8n.io/t/problems-with-python-code-node-in-n8n/299547/2 "2026-06-15T13:01:15Z")

</div>

Welcome @Quent!

Your runner service has two wrong environment variable names that cause the timeout. Replace `N8N_RUNNERS_BROKER_URL` with `N8N_RUNNERS_TASK_BROKER_URI=http://n8n:5679`, and replace `N8N_RUNNERS_ENABLED_MODES` with `N8N_RUNNERS_ENABLED_TASK_TYPES=javascript,python`. Also fix the YAML indentation in your runner’s `environment` block - all items need consistent leading spaces. Here’s the corrected `n8n-runner` service:

> n8n-runner:  
> image: n8nio/runners:latest  
> container\_name: n8n-task-runner  
> restart: always  
> environment:
> 
> - N8N\_RUNNERS\_ENABLED\_TASK\_TYPES=javascript,python
> - N8N\_RUNNERS\_TASK\_BROKER\_URI=[http://n8n:5679](http://n8n:5679)
> - N8N\_RUNNERS\_AUTH\_TOKEN=super\_secure\_token\_change\_me  
> depends\_on:
> - n8n

After updating, run `docker compose down && docker compose up -d`. If timeouts still happen, you can add `N8N_RUNNERS_TASK_REQUEST_TIMEOUT=120` to the `n8n` service environment to give the runner more time.

---

<div class="post-metadata">

**Author:** ![Quent](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/quent/32/175176_2.png) [@Quent](https://community.n8n.io/u/Quent)\
**Post date:** [June 15, 2026, 1:19pm UTC](https://community.n8n.io/t/problems-with-python-code-node-in-n8n/299547/3 "2026-06-15T13:19:50Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [June 22, 2026, 1:19pm UTC](https://community.n8n.io/t/problems-with-python-code-node-in-n8n/299547/4 "2026-06-22T13:19:50Z")

</div>

Closed on June 22, 2026, 1:19pm UTC

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