n8n - 💡(How to fix) Fix Bug with scripts JavaScript & Python

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

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…

Error Message

Describe the problem/error/question

I add a Code Node and select either a JavaScript or a Python script from the menu. In both cases, I receive the following error: expected an indented block after function definition on line 1 (<all_items_task_execution>, line 4).

What is the error message (if any)?

  • error: all

Code Example

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
⚠️ WARNING ⚠️ If you have sensitive data in your workflow (like API keys), please remove it before sharing.
RAW_BUFFERClick to expand / collapse
<!-- Please follow the template below. Skip the questions that are not relevant to you. -->

Describe the problem/error/question

I add a Code Node and select either a JavaScript or a Python script from the menu. In both cases, I receive the following error: expected an indented block after function definition on line 1 (<all_items_task_execution>, line 4). How do I insert the script?

What is the error message (if any)?

Please share your workflow/screenshots/recording

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
⚠️ WARNING ⚠️ If you have sensitive data in your workflow (like API keys), please remove it before sharing.

{ "nodes": [ { "parameters": { "language": "pythonNative" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 416, 0 ], "id": "14e1f104-3087-45cf-ae04-f2469b852c22", "name": "Code in Python" } ], "connections": {}, "pinData": {}, "meta": { "instanceId": "56541fdc9102d0d8c9fc1d0d34f9090d8b553602b9f95ddb1f886fdb61696c2e" } }

Share the output returned by the last node

<!-- If you need help with data transformations, please also share your expected output. -->

Debug info

core

  • n8nVersion: 2.21.7
  • platform: docker (cloud)
  • nodeJsVersion: 24.15.0
  • nodeEnv: production
  • database: sqlite
  • executionMode: regular
  • concurrency: 5
  • license: enterprise (sandbox)

storage

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

pruning

  • enabled: true
  • maxAge: 168 hours
  • maxCount: 2500 executions

client

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

Generated at: 2026-05-26T07:29:20.513Z

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…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING