{"record":{"id":"a8e8173ab0497db3","repo":"n8n-io/n8n","slug":"connection-type-inference-failed","errorCode":"CONNECTION_TYPE_INFERENCE_FAILED","errorMessage":"Could not infer connection type","messagePattern":"Could not infer connection type","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/@n8n/ai-workflow-builder.ee/src/tools/connect-nodes.tool.ts","lineNumber":164,"sourceCode":"\t\t\t\t\t\ttoNodeId: matchedTargetNode.id,\n\t\t\t\t\t});\n\t\t\t\t\tconst error = {\n\t\t\t\t\t\tmessage: connectionError.message,\n\t\t\t\t\t\tcode: 'CONNECTION_TYPE_INFERENCE_ERROR',\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\tsourceNode: matchedSourceNode.name,\n\t\t\t\t\t\t\ttargetNode: matchedTargetNode.name,\n\t\t\t\t\t\t\tpossibleTypes: inferResult.possibleTypes,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\treporter.error(error);\n\t\t\t\t\treturn createErrorResponse(config, error);\n\t\t\t\t}\n\n\t\t\t\tif (!inferResult.connectionType) {\n\t\t\t\t\tconst error = {\n\t\t\t\t\t\tmessage: 'Could not infer connection type',\n\t\t\t\t\t\tcode: 'CONNECTION_TYPE_INFERENCE_FAILED',\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\tsourceNode: matchedSourceNode.name,\n\t\t\t\t\t\t\ttargetNode: matchedTargetNode.name,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\treporter.error(error);\n\t\t\t\t\treturn createErrorResponse(config, error);\n\t\t\t\t}\n\n\t\t\t\tconst connectionType = inferResult.connectionType;\n\t\t\t\tconst inferredSwap = inferResult.requiresSwap ?? false;\n\n\t\t\t\t// If swap is required from inference, swap the nodes\n\t\t\t\tif (inferredSwap) {\n\t\t\t\t\tlogger?.debug('Swapping nodes based on inference result');\n\t\t\t\t\tconst temp = matchedSourceNode;\n\t\t\t\t\tmatchedSourceNode = matchedTargetNode;\n\t\t\t\t\tmatchedTargetNode = temp;","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/ai-workflow-builder.ee/src/tools/connect-nodes.tool.ts#L146-L182","documentation":"Error \"Could not infer connection type\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/ai-workflow-builder.ee/src/tools/connect-nodes.tool.ts:164 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}