{"record":{"id":"a8665a7971d25da5","repo":"n8n-io/n8n","slug":"validation-error-a8665a","errorCode":"VALIDATION_ERROR","errorMessage":"Invalid connection removal parameters","messagePattern":"Invalid connection removal parameters","errorType":"error_code","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/ai-workflow-builder.ee/src/tools/remove-connection.tool.ts","lineNumber":277,"sourceCode":"\t\t\t\t\tsourceNode.name,\n\t\t\t\t\ttargetNode.name,\n\t\t\t\t\tvalidatedInput.connectionType,\n\t\t\t\t\tvalidatedInput.sourceOutputIndex,\n\t\t\t\t\tvalidatedInput.targetInputIndex,\n\t\t\t\t);\n\t\t\t\treturn createSuccessResponse(config, message, stateUpdates);\n\t\t\t} catch (error) {\n\t\t\t\t// Handle validation or unexpected errors\n\t\t\t\tlet toolError;\n\n\t\t\t\tif (error instanceof z.ZodError) {\n\t\t\t\t\tconst validationError = new ValidationError('Invalid connection removal parameters', {\n\t\t\t\t\t\tfield: error.errors[0]?.path.join('.'),\n\t\t\t\t\t\tvalue: error.errors[0]?.message,\n\t\t\t\t\t});\n\t\t\t\t\ttoolError = {\n\t\t\t\t\t\tmessage: validationError.message,\n\t\t\t\t\t\tcode: 'VALIDATION_ERROR',\n\t\t\t\t\t\tdetails: error.errors,\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\ttoolError = {\n\t\t\t\t\t\tmessage: error instanceof Error ? error.message : 'Unknown error occurred',\n\t\t\t\t\t\tcode: 'EXECUTION_ERROR',\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treporter.error(toolError);\n\t\t\t\treturn createErrorResponse(config, toolError);\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tname: REMOVE_CONNECTION_TOOL.toolName,\n\t\t\tdescription: `Remove a specific connection between two nodes in the workflow. This allows you to disconnect nodes without deleting them.\n\nUSAGE:","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/ai-workflow-builder.ee/src/tools/remove-connection.tool.ts#L259-L295","documentation":"Zod schema validation failed on the input to remove_connection. The schema (removeConnectionSchema) requires sourceNodeId and targetNodeId as strings; connectionType defaults to 'main'; sourceOutputIndex and targetInputIndex default to 0. The catch block relabels the ZodError as VALIDATION_ERROR.","triggerScenarios":"Missing sourceNodeId or targetNodeId; non-string IDs; non-numeric indices; connectionType passed as a non-string.","commonSituations":"The LLM omits a required field; indices provided as strings; an object passed instead of a UUID.","solutions":["Read details (ZodError.issues) for the first failing path.","Pass UUID strings for both IDs and numbers (or omit) for indices.","Re-invoke remove_connection with corrected input."],"exampleFix":"// before\nremove_connection.invoke({ source: 'abc', target: 'def' }); // wrong keys\n// after\nremove_connection.invoke({ sourceNodeId: 'abc', targetNodeId: 'def' });","handlingStrategy":"validation","validationCode":"import { removeConnectionSchema } from '@/tools/remove-connection.tool';\n\nconst parsed = removeConnectionSchema.safeParse(input);\nif (!parsed.success) { /* surface parsed.error.issues, skip the tool call */ }","typeGuard":"function isValidRemoveInput(v: unknown): v is { sourceNodeId: string; targetNodeId: string; connectionType?: string; sourceOutputIndex?: number; targetInputIndex?: number } {\n  return typeof v === 'object' && v !== null\n    && typeof (v as any).sourceNodeId === 'string'\n    && typeof (v as any).targetNodeId === 'string';\n}","tryCatchPattern":"try {\n  removeConnectionSchema.parse(input);\n} catch (e) {\n  if (e instanceof z.ZodError) { /* e.issues has field-level detail */ }\n}","preventionTips":["Run the exported schema with safeParse before invoking remove_connection.","Type agent tool-call arguments from the schema's inferred type.","Coerce indices to numbers upstream of the tool."],"tags":["workflow-builder","validation","zod","input"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}