n8n_create_workflow fails: Cannot read properties of undefined (reading '_zod')
Using n8n-mcp v2.26.3 in stdio mode (Node v22.19.0, macOS) with Claude Code via Cursor, every call to
n8n_create_workflowfails withCannot read properties of undefined (reading '_zod'), whilevalidate_workflowand direct n8n API calls with the same JSON succeed. What causes this and how do I fix it?Originally asked on GitHub: https://github.com/czlonkowski/n8n-mcp/issues/444
6 answers
Status: fixed in n8n-mcp v2.27.0.
The maintainer traced the crash to a dependency resolution problem in the MCP server (not in n8n). The
package.jsondeclared"@modelcontextprotocol/sdk": "^1.20.1", so npm resolved to SDK 1.23.0, which accepts"zod": "^3.25 || ^4.0"and got deduplicated to Zod v4. SDK 1.23.0'sisZ4Schema()function crashes when called withundefined, which happens for plain JSON Schema objects. The fix in v2.27.0 pins@modelcontextprotocol/sdkto exactly1.20.1andzodto exactly3.24.1, and adds a CI check to prevent regression:- npm:
npm install n8n-mcp@2.27.0 - Docker:
docker pull ghcr.io/czlonkowski/n8n-mcp:latest
Workaround for older versions (from a commenter, not official): inside the n8n-mcp installation directory, downgrade the dependency stack manually:
bashnpm uninstall @modelcontextprotocol/sdk zod zod-to-json-schema npm install @modelcontextprotocol/sdk@1.22.0 zod@3.25.76 zod-to-json-schema@3.24.1Caveat: this combination then triggers a separate error on partial workflow updates:
"Invalid request: request/body must NOT have additional properties". The commenter worked around that too by patchingdist/services/n8n-api-client.jssoupdateWorkflow()sends only an allowlisted set of fields (name,nodes,connections) and setssettingsto an empty object. That is a manual local patch, not part of the official release.The bug affected both stdio mode (macOS, Node v22) and remote HTTP/Docker deployments (n8n-mcp 2.26.4, Zod 4.1.13). Direct calls to the n8n REST API with the same workflow JSON succeeded, confirming the n8n API itself was fine, so upgrading to 2.27.0 is the reliable path.
Did this work for you?- npm:
What a GitHub user tried on GitHub (Didn't work)
Reporter called n8n_create_workflow and consistently received
Cannot read properties of undefined (reading '_zod').Source: https://github.com/czlonkowski/n8n-mcp/issues/444 (opens external site)
Did this work for you?What @raphmyster tried on GitHub (Partly worked)
Commenter isolated the failure: n8n_create_workflow failed with every tested node combination, typeVersion (1–4), and parameter style, while validate_node, validate_workflow, n8n_list_workflows, and n8n_get_workflow worked. A direct
curl -X POSTto the n8n/api/v1/workflowsendpoint with the same JSON succeeded, proving the n8n API was not at fault.Source: https://github.com/czlonkowski/n8n-mcp/issues/444#issuecomment-3578972993 (opens external site)
Did this work for you?What @RyanMcLarenHolmes tried on GitHub (Worked)
Commenter downgraded inside the n8n-mcp install to @modelcontextprotocol/sdk@1.22.0, zod@3.25.76, and zod-to-json-schema@3.24.1, then patched updateWorkflow() to send only the allowlisted fields (name, nodes, connections) with settings set to an empty object to avoid the follow-up "additional properties" error.
Source: https://github.com/czlonkowski/n8n-mcp/issues/444#issuecomment-3579156365 (opens external site)
Did this work for you?What @bytefrostdev tried on GitHub (Partly worked)
Commenter reproduced the same
_zodfailure on a remote HTTP/Docker deployment (n8n-mcp 2.26.4, Zod 4.1.13) with 18/19 tools working; a direct n8n REST API call with the same workflow JSON succeeded, confirming the issue was isolated to the MCP server's workflow creation tool.Source: https://github.com/czlonkowski/n8n-mcp/issues/444#issuecomment-3583320371 (opens external site)
Did this work for you?What @czlonkowski tried on GitHub (Worked)
Maintainer released v2.27.0, pinning @modelcontextprotocol/sdk@1.20.1 and zod@3.24.1 so npm no longer resolves to Zod v4, and added CI to keep the pins in place.
Source: https://github.com/czlonkowski/n8n-mcp/issues/444#issuecomment-3590707887 (opens external site)
Did this work for you?
Related questions
- n8n-MCP: complex Claude Desktop workflows won't open in n8n UI — 'propertyValues is not iterable'?
- n8n-mcp partial update fails: 'Cannot convert undefined or null to object' (Claude Desktop/Cursor)
- n8n-mcp n8n_update_partial_workflow updateNode fails with "Cannot convert undefined or null to object"
- n8n-mcp Docker: missing BACKEND_SUPABASE_URL after pulling latest image
- n8n_update_partial_workflow fails: "settings must NOT have additional properties"