mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-02-08 14:23:08 +00:00
fix: correct version extraction and typeVersion validation for langchain nodes
This commit fixes two critical bugs affecting AI Agent and other langchain nodes: 1. Version Extraction Bug (node-parser.ts) - AI Agent was returning version "3" instead of "2.2" (the defaultVersion) - Root cause: extractVersion() checked non-existent instance.baseDescription.defaultVersion - Fix: Updated priority to check currentVersion first, then description.defaultVersion - Impact: All VersionedNodeType nodes now return correct version 2. typeVersion Validation Bypass (workflow-validator.ts) - Langchain nodes with invalid typeVersion passed validation (even typeVersion: 99999) - Root cause: langchain skip happened before typeVersion validation - Fix: Moved typeVersion validation before langchain parameter skip - Impact: Invalid typeVersion values now properly caught for all nodes Also includes: - Database rebuilt with corrected version data (536 nodes) - Version bump: 2.17.3 → 2.17.4 - Comprehensive CHANGELOG entry 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -397,14 +397,7 @@ export class WorkflowValidator {
|
||||
node.type = normalizedType;
|
||||
}
|
||||
|
||||
// Skip ALL node repository validation for langchain nodes
|
||||
// They have dedicated AI-specific validators in validateAISpecificNodes()
|
||||
// This prevents parameter validation conflicts and ensures proper AI validation
|
||||
if (normalizedType.startsWith('nodes-langchain.')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get node definition using normalized type
|
||||
// Get node definition using normalized type (needed for typeVersion validation)
|
||||
const nodeInfo = this.nodeRepository.getNode(normalizedType);
|
||||
|
||||
if (!nodeInfo) {
|
||||
@@ -451,7 +444,8 @@ export class WorkflowValidator {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Validate typeVersion for versioned nodes
|
||||
// Validate typeVersion for ALL versioned nodes (including langchain nodes)
|
||||
// This validation runs BEFORE the langchain skip to ensure typeVersion is checked
|
||||
if (nodeInfo.isVersioned) {
|
||||
// Check if typeVersion is missing
|
||||
if (!node.typeVersion) {
|
||||
@@ -461,7 +455,7 @@ export class WorkflowValidator {
|
||||
nodeName: node.name,
|
||||
message: `Missing required property 'typeVersion'. Add typeVersion: ${nodeInfo.version || 1}`
|
||||
});
|
||||
}
|
||||
}
|
||||
// Check if typeVersion is invalid
|
||||
else if (typeof node.typeVersion !== 'number' || node.typeVersion < 1) {
|
||||
result.errors.push({
|
||||
@@ -491,6 +485,13 @@ export class WorkflowValidator {
|
||||
}
|
||||
}
|
||||
|
||||
// Skip parameter validation for langchain nodes
|
||||
// They have dedicated AI-specific validators in validateAISpecificNodes()
|
||||
// This prevents parameter validation conflicts and ensures proper AI validation
|
||||
if (normalizedType.startsWith('nodes-langchain.')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Validate node configuration
|
||||
const nodeValidation = this.nodeValidator.validateWithMode(
|
||||
node.type,
|
||||
|
||||
Reference in New Issue
Block a user