n8n-io/n8n · error

CONNECTION_TYPE_INFERENCE_FAILED

CONNECTION_TYPE_INFERENCE_FAILED

Error message

Could not infer connection type

What it means

inferConnectionType completed without an error but could not determine a single connectionType (ambiguous or none found). Unlike the inference-error case, this is an inconclusive result; the tool returns CONNECTION_TYPE_INFERENCE_FAILED with the possible candidate types in details so the caller can disambiguate.

Solutions

  1. Choose explicitly among the possibleTypes listed in the error details and pass the connection type in the tool call
  2. Check node versions — a different version may expose unambiguous connection outputs/inputs
  3. Restructure the connection through a node with a well-defined single connection type
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at packages/@n8n/ai-workflow-builder.ee/src/tools/connect-nodes.tool.ts:164 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

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

						toNodeId: matchedTargetNode.id,
					});
					const error = {
						message: connectionError.message,
						code: 'CONNECTION_TYPE_INFERENCE_ERROR',
						details: {
							sourceNode: matchedSourceNode.name,
							targetNode: matchedTargetNode.name,
							possibleTypes: inferResult.possibleTypes,
						},
					};
					reporter.error(error);
					return createErrorResponse(config, error);
				}

				if (!inferResult.connectionType) {
					const error = {
						message: 'Could not infer connection type',
						code: 'CONNECTION_TYPE_INFERENCE_FAILED',
						details: {
							sourceNode: matchedSourceNode.name,
							targetNode: matchedTargetNode.name,
						},
					};
					reporter.error(error);
					return createErrorResponse(config, error);
				}

				const connectionType = inferResult.connectionType;
				const inferredSwap = inferResult.requiresSwap ?? false;

				// If swap is required from inference, swap the nodes
				if (inferredSwap) {
					logger?.debug('Swapping nodes based on inference result');
					const temp = matchedSourceNode;
					matchedSourceNode = matchedTargetNode;
					matchedTargetNode = temp;

View on GitHub (pinned to 5ac6606e81)