mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-01-30 06:22:04 +00:00
fix: Add helpful error messages for 'changes' vs 'updates' parameter (Issue #392)
Fixed cryptic "Cannot read properties of undefined (reading 'name')" error when
users mistakenly use 'changes' instead of 'updates' in updateNode operations.
Changes:
- Added early validation in validateUpdateNode() to detect common parameter mistake
- Provides clear, educational error messages with examples
- Fixed outdated documentation example in VS_CODE_PROJECT_SETUP.md
- Added comprehensive test coverage (2 test cases)
Error Messages:
- Before: "Diff engine error: Cannot read properties of undefined (reading 'name')"
- After: "Invalid parameter 'changes'. The updateNode operation requires 'updates'
(not 'changes'). Example: {type: "updateNode", nodeId: "abc", updates: {...}}"
Testing:
- Test coverage: 85% confidence (production ready)
- n8n-mcp-tester: All 3 test cases passed
- Code review: Approved with minor optional suggestions
Impact:
- AI agents now receive actionable error messages
- Self-correction enabled through clear examples
- Zero breaking changes (backward compatible)
- Follows existing patterns from Issue #249
Files Modified:
- src/services/workflow-diff-engine.ts (10 lines added)
- docs/VS_CODE_PROJECT_SETUP.md (1 line fixed)
- tests/unit/services/workflow-diff-engine.test.ts (2 tests added)
- CHANGELOG.md (comprehensive entry)
- package.json (version bump to 2.22.12)
Fixes #392
Conceived by Romuald Członkowski - www.aiadvisors.pl/en
This commit is contained in:
@@ -162,7 +162,7 @@ n8n_validate_workflow({id: createdWorkflowId})
|
||||
n8n_update_partial_workflow({
|
||||
workflowId: id,
|
||||
operations: [
|
||||
{type: 'updateNode', nodeId: 'slack1', changes: {position: [100, 200]}}
|
||||
{type: 'updateNode', nodeId: 'slack1', updates: {position: [100, 200]}}
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user