n8n - ✅(Solved) Fix [MCP SDK] Silent fallback when node parameters placed at top level of config instead of config.parameters [1 pull requests, 5 comments, 3 participants]

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…
GitHub stats
n8n-io/n8n#29154Fetched 2026-04-28 06:49:34
View on GitHub
Comments
5
Participants
3
Timeline
15
Reactions
0
Timeline (top)
commented ×5labeled ×3mentioned ×3subscribed ×3

Error Message

The root cause is that the serializer reads only config.parameters, while parameters placed directly under config (e.g. config: { mode, jsCode, ... }) are dropped. There is currently no warning or error to indicate that unknown keys at the top level of config were ignored. This is particularly problematic for LLM-based MCP clients (e.g. Claude via Claude.ai), which routinely skip the get_sdk_reference step when they pattern-match the SDK shape from prior context. The result is a "successful" workflow creation where everything looks correct until runtime, leading to a frustrating debugging loop because the first failure surface is a generic "Unknown error" at execution time. 9. Execute the workflow manually: fails with Problem in node 'Code' / Unknown error. validate_workflow should emit a warning (or, ideally, a hard error) when unknown keys are detected at the top level of a node's config. Something like: Execution: fails with generic Unknown error at the first node that needs the missing parameters.

Root Cause

When using the n8n MCP SDK to create workflows via create_workflow_from_code (or validate_workflow), node-specific parameters placed at the top level of the config object are silently ignored by the serializer. The workflow is created successfully, all nodes appear on the canvas with their connections intact, and validate_workflow returns valid: true with the correct nodeCount. However, the resulting nodes have empty parameters, which only becomes visible when opening a node in the UI or attempting to execute the workflow. The root cause is that the serializer reads only config.parameters, while parameters placed directly under config (e.g. config: { mode, jsCode, ... }) are dropped. There is currently no warning or error to indicate that unknown keys at the top level of config were ignored. This is particularly problematic for LLM-based MCP clients (e.g. Claude via Claude.ai), which routinely skip the get_sdk_reference step when they pattern-match the SDK shape from prior context. The result is a "successful" workflow creation where everything looks correct until runtime, leading to a frustrating debugging loop because the first failure surface is a generic "Unknown error" at execution time.

Fix Action

Fixed

PR fix notes

PR #28053: fix(core): Improve error messages for invalid node and trigger input

Description (problem / solution / changelog)

Summary

trigger() and node() crash with an opaque error when called with a string as the first argument instead of a config object:

TypeError: Cannot read properties of undefined (reading 'name')

This surfaces to MCP users as Failed to parse generated workflow code: Cannot read properties of undefined (reading 'name'), with no hint of what went wrong.

Changes:

  • node() and trigger() now throw a descriptive TypeError with a usage example when input isn't an object
  • config?.name optional chaining in NodeInstanceImpl constructor as a defensive fallback
  • 5 new test cases

Related Linear tickets, Github issues, and Community forum posts

Fixes #28025 Fixes #28046

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Tests included.
  • Docs updated or follow-up ticket created.
  • PR Labeled with Backport to Beta, Backport to Stable, or Backport to v1
  • I have seen this code, I have run this code, and I take responsibility for this code.

Changed files

  • packages/@n8n/workflow-sdk/src/validation/schema-validation-integration.test.ts (modified, +1/-1)
  • packages/@n8n/workflow-sdk/src/workflow-builder.test.ts (modified, +14/-0)
  • packages/@n8n/workflow-sdk/src/workflow-builder.ts (modified, +11/-2)
  • packages/@n8n/workflow-sdk/src/workflow-builder/connection-utils.ts (modified, +1/-1)
  • packages/@n8n/workflow-sdk/src/workflow-builder/control-flow-builders/split-in-batches.ts (modified, +6/-0)
  • packages/@n8n/workflow-sdk/src/workflow-builder/node-builders/node-builder.test.ts (modified, +83/-0)
  • packages/@n8n/workflow-sdk/src/workflow-builder/node-builders/node-builder.ts (modified, +15/-1)
  • packages/@n8n/workflow-sdk/src/workflow-builder/validation-helpers.ts (modified, +11/-0)
RAW_BUFFERClick to expand / collapse

Bug Description

When using the n8n MCP SDK to create workflows via create_workflow_from_code (or validate_workflow), node-specific parameters placed at the top level of the config object are silently ignored by the serializer. The workflow is created successfully, all nodes appear on the canvas with their connections intact, and validate_workflow returns valid: true with the correct nodeCount. However, the resulting nodes have empty parameters, which only becomes visible when opening a node in the UI or attempting to execute the workflow. The root cause is that the serializer reads only config.parameters, while parameters placed directly under config (e.g. config: { mode, jsCode, ... }) are dropped. There is currently no warning or error to indicate that unknown keys at the top level of config were ignored. This is particularly problematic for LLM-based MCP clients (e.g. Claude via Claude.ai), which routinely skip the get_sdk_reference step when they pattern-match the SDK shape from prior context. The result is a "successful" workflow creation where everything looks correct until runtime, leading to a frustrating debugging loop because the first failure surface is a generic "Unknown error" at execution time.

To Reproduce

  1. Connect a Claude.ai (or other LLM-based MCP client) to a self-hosted n8n instance via MCP.
  2. Prompt the agent to create a minimal 3-node workflow: Manual Trigger → Set → Code.
  3. The agent calls validate_workflow with the following SDK code (parameters at top level of config):

import { workflow, trigger, node } from "@n8n/workflow-sdk";

const manualTrigger = trigger({ type: "n8n-nodes-base.manualTrigger", version: 1, config: {}, });

const setFields = node({ type: "n8n-nodes-base.set", version: 3.4, config: { mode: "manual", assignments: { assignments: [ { id: "a1", name: "messaggio", value: "Test", type: "string" }, ], }, }, });

const codeNode = node({ type: "n8n-nodes-base.code", version: 2, config: { mode: "runOnceForAllItems", language: "javaScript", jsCode: "return [{ json: { ok: true } }];", }, });

const wf = workflow("TEST"); wf.add(manualTrigger.output(0).to(setFields)); wf.add(setFields.output(0).to(codeNode)); export default wf;

import { workflow, trigger, node } from "@n8n/workflow-sdk";

const manualTrigger = trigger({ type: "n8n-nodes-base.manualTrigger", version: 1, config: {}, });

const setFields = node({ type: "n8n-nodes-base.set", version: 3.4, config: { mode: "manual", assignments: { assignments: [ { id: "a1", name: "messaggio", value: "Test", type: "string" }, ], }, }, });

const codeNode = node({ type: "n8n-nodes-base.code", version: 2, config: { mode: "runOnceForAllItems", language: "javaScript", jsCode: "return [{ json: { ok: true } }];", }, });

const wf = workflow("TEST"); wf.add(manualTrigger.output(0).to(setFields)); wf.add(setFields.output(0).to(codeNode)); export default wf;

  1. validate_workflow returns { valid: true, nodeCount: 3 }.
  2. create_workflow_from_code creates the workflow successfully.
  3. Open the workflow in the UI: nodes appear correctly connected on the canvas.
  4. Open the Set node: the Mode and Assignments fields are empty.
  5. Open the Code node: the Language, Mode and JS Code fields are empty.
  6. Execute the workflow manually: fails with Problem in node 'Code' / Unknown error.

Expected behavior

validate_workflow should emit a warning (or, ideally, a hard error) when unknown keys are detected at the top level of a node's config. Something like:

WARNING: Node "Code" has unknown keys at the top level of config: ["mode", "language", "jsCode"]. Did you mean to place them under config.parameters?

This would short-circuit the silent failure: the LLM agent would see the warning during validation and self-correct before the workflow is created, instead of producing a "successful" empty workflow that only fails at runtime. Actual Behavior validate_workflow: returns { valid: true, nodeCount: 3 } with no warnings. create_workflow_from_code: returns a successful response with nodeCount: 3 and a working URL. Canvas: shows all 3 nodes correctly connected. Node parameters: empty. Execution: fails with generic Unknown error at the first node that needs the missing parameters. The correct syntax (which I have now confirmed works end-to-end on my instance) is:

node({ type: "n8n-nodes-base.code", version: 2, config: { parameters: { mode: "runOnceForAllItems", language: "javaScript", jsCode: "return [{ json: { ok: true } }];", }, }, })

Debug Info

MCP client behavior observed: search_nodes and get_node_types were called by the agent before writing the workflow code. get_sdk_reference was not called — the agent pattern-matched the SDK shape from prior context. This is the failure mode: agent skips reference fetch → guesses SDK structure → silent serialization drops unknown keys → validate_workflow returns green → user discovers the bug only at runtime. Reproducible workflow (post-fix on my instance): created with the incorrect syntax first (empty parameters confirmed), then updated with the correct syntax (config.parameters) and executed successfully (execution 94756, status: success, output: {"upper": "TEST FIX MCP RIUSCITO", "elaborato": true}). Suggested fix priority: I'd rank a validation warning as more impactful than docs improvements, because LLM agents routinely skip reference-fetch steps when they think they already know the API shape. A loud failure at validation time would catch this entire class of issues before workflow creation.

Operating System

Linux (Ubuntu, Hostinger VPS)

n8n Version

2.17.7

Node.js Version

v24.13.1

Database

SQLite (default)

Execution mode

main (default)

Hosting

self hosted

extent analysis

TL;DR

The issue can be resolved by placing node-specific parameters under the config.parameters object instead of the top level of the config object.

Guidance

  • To fix the issue, update the node configuration to use the correct syntax, e.g., config: { parameters: { mode: "runOnceForAllItems", language: "javaScript", jsCode: "return [{ json: { ok: true } }];" } }.
  • Verify that the validate_workflow function returns a warning or error when unknown keys are detected at the top level of a node's config.
  • Test the workflow execution after updating the node configuration to ensure that it runs successfully without errors.
  • Consider adding a validation warning or error in the validate_workflow function to catch similar issues in the future.

Example

const codeNode = node({
  type: "n8n-nodes-base.code",
  version: 2,
  config: {
    parameters: {
      mode: "runOnceForAllItems",
      language: "javaScript",
      jsCode: "return [{ json: { ok: true } }];",
    },
  },
});

Notes

The issue is specific to the n8n MCP SDK and the way it handles node configuration. The suggested fix should resolve the issue, but it's essential to test the workflow execution after updating the node configuration.

Recommendation

Apply the workaround by updating the node configuration to use the correct syntax, as this will resolve the issue and prevent similar problems in the future.

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…

FAQ

Expected behavior

validate_workflow should emit a warning (or, ideally, a hard error) when unknown keys are detected at the top level of a node's config. Something like:

WARNING: Node "Code" has unknown keys at the top level of config: ["mode", "language", "jsCode"]. Did you mean to place them under config.parameters?

This would short-circuit the silent failure: the LLM agent would see the warning during validation and self-correct before the workflow is created, instead of producing a "successful" empty workflow that only fails at runtime. Actual Behavior validate_workflow: returns { valid: true, nodeCount: 3 } with no warnings. create_workflow_from_code: returns a successful response with nodeCount: 3 and a working URL. Canvas: shows all 3 nodes correctly connected. Node parameters: empty. Execution: fails with generic Unknown error at the first node that needs the missing parameters. The correct syntax (which I have now confirmed works end-to-end on my instance) is:

node({ type: "n8n-nodes-base.code", version: 2, config: { parameters: { mode: "runOnceForAllItems", language: "javaScript", jsCode: "return [{ json: { ok: true } }];", }, }, })

Still need to ship something?

×6

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

Back to top recommendations

TRENDING