n8n - 💡(How to fix) Fix [MCP SDK] `validate_workflow` and `create_workflow_from_code` fail with "builder.regenerateNodeIds is not a function" [1 comments, 2 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#28377Fetched 2026-04-13 05:45:19
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
commented ×1labeled ×1mentioned ×1subscribed ×1

Error Message

When using the n8n MCP Server tools (validate_workflow and create_workflow_from_code) via an MCP client (e.g., Claude Desktop), every workflow code submission fails with the internal error: This error occurs regardless of the SDK code syntax used — whether using factory functions, explicit node configurations, or minimal examples. It appears to be a bug in the MCP server's internal workflow builder/parser, not in the user-provided code. The error prevents any workflow from being created or validated through the MCP SDK tools, making these tools completely unusable. 3. Observe the error: builder.regenerateNodeIds is not a function 4. The same error occurs with create_workflow_from_code Variations tried (all produce the same error): Both validate_workflow and create_workflow_from_code immediately return the error: This is an internal error in the MCP server's workflow builder — not a validation error about the user-provided code. No workflow is created or validated. The error is 100% reproducible with any SDK code input.

Code Example

builder.regenerateNodeIds is not a function

---

const myTrigger = webhook({ path: 'test-hook' });
myTrigger.next(code({ language: 'javaScript', jsCode: 'return items;' }));

---

builder.regenerateNodeIds is not a function
RAW_BUFFERClick to expand / collapse

Bug Description

When using the n8n MCP Server tools (validate_workflow and create_workflow_from_code) via an MCP client (e.g., Claude Desktop), every workflow code submission fails with the internal error:

builder.regenerateNodeIds is not a function

This error occurs regardless of the SDK code syntax used — whether using factory functions, explicit node configurations, or minimal examples. It appears to be a bug in the MCP server's internal workflow builder/parser, not in the user-provided code.

The error prevents any workflow from being created or validated through the MCP SDK tools, making these tools completely unusable.

To Reproduce

  1. Connect to a self-hosted n8n instance via the n8n MCP Server
  2. Call validate_workflow with any valid SDK code, for example:
const myTrigger = webhook({ path: 'test-hook' });
myTrigger.next(code({ language: 'javaScript', jsCode: 'return items;' }));
  1. Observe the error: builder.regenerateNodeIds is not a function
  2. The same error occurs with create_workflow_from_code

Variations tried (all produce the same error):

  • Using factory functions (webhook(), code(), etc.)
  • Using explicit node configuration objects with type, typeVersion, parameters
  • Minimal single-node workflows
  • Workflows with and without id, version, position fields
  • Using .next() for connections vs not connecting nodes at all

Expected behavior

validate_workflow should parse the SDK code into a valid workflow JSON and return it (or return validation errors about the code itself).

create_workflow_from_code should create the workflow in the n8n instance after successful validation.

Debug Info

Both validate_workflow and create_workflow_from_code immediately return the error:

builder.regenerateNodeIds is not a function

This is an internal error in the MCP server's workflow builder — not a validation error about the user-provided code. No workflow is created or validated. The error is 100% reproducible with any SDK code input.

Operating System

Ubuntu Linux (Docker, self-hosted)

n8n Version

Latest (self-hosted, April 2026)

Node.js Version

N/A (MCP Server side)

Database

SQLite (default)

Execution mode

main (default)

Hosting

n8n cloud

extent analysis

TL;DR

The most likely fix is to update or modify the MCP server's internal workflow builder to include the missing regenerateNodeIds function.

Guidance

  • Verify that the regenerateNodeIds function is indeed missing from the MCP server's workflow builder by checking the server-side code.
  • Check the n8n documentation and GitHub issues for any known problems or fixes related to the regenerateNodeIds function.
  • If possible, try to manually add the regenerateNodeIds function to the workflow builder or update the MCP server to a version that includes this function.
  • Test the validate_workflow and create_workflow_from_code functions with a minimal workflow example to isolate the issue.

Example

No code snippet is provided as the issue is related to a missing function on the server-side, and the client-side code appears to be correct.

Notes

The exact solution may depend on the internal implementation of the MCP server's workflow builder, which is not provided in the issue. Additionally, the issue may be specific to the self-hosted n8n instance or the Ubuntu Linux operating system.

Recommendation

Apply a workaround by manually adding the regenerateNodeIds function to the workflow builder or updating the MCP server to a version that includes this function, as the error is caused by a missing function on the server-side.

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 parse the SDK code into a valid workflow JSON and return it (or return validation errors about the code itself).

create_workflow_from_code should create the workflow in the n8n instance after successful validation.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING