n8n-io/n8n · error

EXECUTION_ERROR

EXECUTION_ERROR

Error message

Unknown error occurred

What it means

A non-Error, non-ZodError value was thrown inside connect_nodes. Because the value has no .message property, the catch block falls through to the literal 'Unknown error occurred' string with code EXECUTION_ERROR. This path indicates a programming defect or an unexpected rejection shape, not a user input problem.

Source

Thrown at packages/@n8n/ai-workflow-builder.ee/src/tools/connect-nodes.tool.ts:296

				return createSuccessResponse(config, message, stateUpdates);
			} catch (error) {
				// Handle validation or unexpected errors
				let toolError;

				if (error instanceof z.ZodError) {
					const validationError = new ValidationError('Invalid connection parameters', {
						field: error.errors[0]?.path.join('.'),
						value: error.errors[0]?.message,
					});
					toolError = {
						message: validationError.message,
						code: 'VALIDATION_ERROR',
						details: error.errors,
					};
				} else {
					toolError = {
						message: error instanceof Error ? error.message : 'Unknown error occurred',
						code: 'EXECUTION_ERROR',
					};
				}

				reporter.error(toolError);
				return createErrorResponse(config, toolError);
			}
		},
		{
			name: CONNECT_NODES_TOOL.toolName,
			description: `Connect two nodes in the workflow. The tool automatically determines the connection type based on node capabilities and ensures correct connection direction.

UNDERSTANDING CONNECTIONS:
- SOURCE NODE: The node that PRODUCES output/provides capability
- TARGET NODE: The node that RECEIVES input/uses capability
- Flow direction: Source → Target

AUTOMATIC CONNECTION TYPE DETECTION:
- The tool analyzes the nodes' inputs and outputs to determine the appropriate connection type

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Check server logs for the original thrown value (reporter.error logs the toolError but the raw throw site may log separately).
  2. Reproduce with the same workflow JSON and node IDs, then inspect the stack trace if available.
  3. Report as a bug: include workflow JSON, node IDs, and the inferred connection type.
Defensive patterns

Strategy: try-catch

Type guard

function isToolError(v: unknown): v is { message: string; code: string; details?: unknown } {
  return typeof v === 'object' && v !== null && 'code' in v && 'message' in v;
}

Try / catch

const res = await connect_nodes.invoke(input);
if (isToolError(res) && res.code === 'EXECUTION_ERROR' && res.message === 'Unknown error occurred') {
  // This is a defect path: log the workflow JSON + node IDs and surface a generic
  // retry prompt to the agent. Do not silently retry with identical input.
  logger.error({ input }, 'connect_nodes unknown error');
}

Prevention

When it happens

Trigger: A helper throws a string/number/null; a promise rejects with a non-Error value; an assert helper throws a plain object; a third-party dependency rejects with a string.

Common situations: Bug in a connection-utils helper that throws a literal string; state accessor returns undefined and a downstream guard throws a non-Error; race in getWorkflowState() under concurrent tool calls.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/afe76d575db2cac5. Report an issue: GitHub.