{"record":{"id":"afe76d575db2cac5","repo":"n8n-io/n8n","slug":"execution-error","errorCode":"EXECUTION_ERROR","errorMessage":"Unknown error occurred","messagePattern":"Unknown error occurred","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/@n8n/ai-workflow-builder.ee/src/tools/connect-nodes.tool.ts","lineNumber":296,"sourceCode":"\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 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: CONNECT_NODES_TOOL.toolName,\n\t\t\tdescription: `Connect two nodes in the workflow. The tool automatically determines the connection type based on node capabilities and ensures correct connection direction.\n\nUNDERSTANDING CONNECTIONS:\n- SOURCE NODE: The node that PRODUCES output/provides capability\n- TARGET NODE: The node that RECEIVES input/uses capability\n- Flow direction: Source → Target\n\nAUTOMATIC CONNECTION TYPE DETECTION:\n- The tool analyzes the nodes' inputs and outputs to determine the appropriate connection type","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/ai-workflow-builder.ee/src/tools/connect-nodes.tool.ts#L278-L314","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check server logs for the original thrown value (reporter.error logs the toolError but the raw throw site may log separately).","Reproduce with the same workflow JSON and node IDs, then inspect the stack trace if available.","Report as a bug: include workflow JSON, node IDs, and the inferred connection type."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isToolError(v: unknown): v is { message: string; code: string; details?: unknown } {\n  return typeof v === 'object' && v !== null && 'code' in v && 'message' in v;\n}","tryCatchPattern":"const res = await connect_nodes.invoke(input);\nif (isToolError(res) && res.code === 'EXECUTION_ERROR' && res.message === 'Unknown error occurred') {\n  // This is a defect path: log the workflow JSON + node IDs and surface a generic\n  // retry prompt to the agent. Do not silently retry with identical input.\n  logger.error({ input }, 'connect_nodes unknown error');\n}","preventionTips":["Treat EXECUTION_ERROR with 'Unknown error occurred' as a bug signal, not a user error.","Capture the workflow JSON and node IDs at the call site for reproducible bug reports.","Do not retry the identical invocation; change the input or report the failure."],"tags":["workflow-builder","bug","unhandled","execution"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}