Starbase / 02 RecipeAgents

RecipeAgents / n8n nodes / Code

Node reference · data pulled Oct 26, 2026

n8n Code node: what the data shows

Runs JavaScript or Python you write, on the items passing through the workflow.

8,061public templates use it (59.4% of 13,574)
55.0%of those also contain an AI node
51.0score out of 80 · rank 18 of 22
125commits to its source folder on GitHub

What it does

Reach for it when no built-in node does the reshaping or logic you need. It has two run modes: once for all items, where your code receives the whole list and returns a new list, or once for each item. Either way, what you hand back has to be a list of objects with the data under a json key. Most Code node errors come from breaking that shape.

It is the most used node in the public library, and it keeps growing: it appears in a larger share of 2026 templates than of 2025 ones (see the year table below).

How often public templates use it

8,061 of the 13,574 public templates on n8n.io (59.4%) contain this node, in the snapshot we took on 2026-10-20. The table splits that by the year each template was published. 2026 runs to October 20.

Year publishedTemplates with the nodeShare of that year
2024155 of 46233.5%
20253,375 of 6,56451.4%
20264,485 of 5,84576.7%

The median template using this node has 124 views on n8n.io, against 284 for all templates. Template counts show what people publish, not what runs in production.

What it is used with

The most frequent partners are the nodes that appear most often in the same templates. "Lift" compares that with the whole library: 2× means the partner turns up twice as often next to this node as in an average template.

Most frequent partnerShare of its templatesLift
If59.9%1.19×
HTTP Request59.6%1.16×
Edit Fields (Set)57.9%1.04×
Google Sheets42.5%1.19×
Schedule Trigger40.1%1.26×
AI Agent29.5%0.94×

No partner clears our strong-pairing bar (in at least 5% of its templates and 1.5× the library rate). That is typical of nodes used almost everywhere: they sit next to everything about as often as average.

Most viewed public templates that use it: Automate multi platform social media content creation with ai (442,651 views); Fully automated ai video generation and multi platform publishing (402,403 views); Generate ai viral videos with seedance and upload to tiktok youtube and instagram (349,477 views).

Versions and changes

Node versions from the npm packages n8n-nodes-base and @n8n/n8n-nodes-langchain, version 2.44.4. New workflows get the default version; workflows built earlier keep the version they were built with until you replace the node.

NodeVersionsDefaultCredential typesScope
Code1, 22none needed–

Source on GitHub: packages/nodes-base/nodes/Code: 125 commits since 2022-10-13, last on 2026-09-01.

Recent fixes and features

  • 2026-09-01: fix(Code Node): Keep identity and reporting fields when wrapping task runner errors (PR #37490)
  • 2025-07-03: fix(Code Node): Only Block os.system vs Blocking import os (PR #16885)
  • 2025-06-27: fix(Code Node): Error formatting fix (PR #16719)
  • 2025-06-03: fix(Code Node): Block selected module imports in python code (PR #15970)
  • 2025-05-07: fix(Code Node): Update pyodide sandbox context to fix micropip regressions (PR #15181)
  • 2025-04-23: fix(Code Node): Upgrade pyodide, sandbox it, and prevent JS sandbox escape (PR #14356)

Merged dates from GitHub. A fix only helps once your n8n instance runs a release that includes it, so check your version.

Known problems

  • Wrong return shape. Returning a bare value, an array without the json wrapper, or nothing at all stops the node. Return a list of {json: {...}} objects. Source: n8n docs
  • import/export syntax fails. ES module import lines are not allowed in the node; load modules with require(). Source: n8n docs
  • npm modules only on self-hosted n8n. Outside modules have to be installed on your own server and allowed with the NODE_FUNCTION_ALLOW_BUILTIN / NODE_FUNCTION_ALLOW_EXTERNAL variables. n8n Cloud does not allow them. Source: n8n docs
  • No credentials inside Code. The node cannot read stored credentials. Make the authenticated call with an HTTP Request node and pass the result in. Source: n8n docs
  • Python sandbox changes. The Python runtime was upgraded and sandboxed in 2025, and some module imports are now blocked; older Python snippets may need edits. Source: n8n PR #14356

Forum trouble signal: not measured. The n8n community forum's terms forbid automated access, so we don't count forum threads.

Our recipes that use it

2 of our 25 importable workflows use this node:

Official docs and sources

Usage, pairings, AI share and views: our count of 13,574 public n8n.io templates (snapshot 2026-10-20). Versions: npm packages, version 2.44.4. Changes: n8n's GitHub repository. Docs read and data pulled Oct 26, 2026. We describe each node in our own words; the docs are the authority on settings.

Related nodes

Questions

How many n8n templates use the Code node?
8,061 of the 13,574 public templates on n8n.io (59.4%), in our snapshot of 2026-10-20.
What is the Code node most often used with?
If, which appears in 59.9% of its templates.
Can the n8n Code node use npm packages?
Only on self-hosted n8n, after you install the package and allow it with an environment variable. n8n Cloud does not allow external modules.
JavaScript or Python?
Both. JavaScript is the default; Python runs in a sandbox that blocks some imports.
Newsletter

One small automation every Friday

Each Friday email has one recipe, the prompt for it, and the way it broke when we wrote it up. It's free, and every email has an unsubscribe link.