n8n-io/n8n · warning · ConnectionError

OUTPUT_INDEX_NOT_FOUND

OUTPUT_INDEX_NOT_FOUND

Error message

Source node "${sourceNode.name}" has no connections at output index ${validatedInput.sourceOutputIndex}

What it means

remove_connection drilled into sourceConnections[connectionType] and found that the entry at sourceOutputIndex is missing or not an array. The requested output branch has no connections.

Source

Thrown at packages/@n8n/ai-workflow-builder.ee/src/tools/remove-connection.tool.ts:187

							availableConnectionTypes: Object.keys(sourceConnections),
						},
					};
					reporter.error(error);
					return createErrorResponse(config, error);
				}

				const outputConnections = connectionTypeOutputs[validatedInput.sourceOutputIndex];
				if (!outputConnections || !Array.isArray(outputConnections)) {
					const connectionError = new ConnectionError(
						`Source node "${sourceNode.name}" has no connections at output index ${validatedInput.sourceOutputIndex}`,
						{
							fromNodeId: sourceNode.id,
							toNodeId: targetNode.id,
						},
					);
					const error = {
						message: connectionError.message,
						code: 'OUTPUT_INDEX_NOT_FOUND',
						details: {
							sourceNode: sourceNode.name,
							targetNode: targetNode.name,
							connectionType: validatedInput.connectionType,
							sourceOutputIndex: validatedInput.sourceOutputIndex,
						},
					};
					reporter.error(error);
					return createErrorResponse(config, error);
				}

				// Check if the specific connection exists
				const connectionExists = outputConnections.some(
					(conn) =>
						conn.node === targetNode.name &&
						conn.type === validatedInput.connectionType &&
						conn.index === validatedInput.targetInputIndex,
				);

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Lower sourceOutputIndex to a populated branch (typically 0).
  2. Inspect the node's outputs via get_node_details to find which indices have connections.
  3. Re-issue with the correct index or default (0).

Example fix

// before
remove_connection.invoke({ ..., sourceOutputIndex: 1 });
// after
remove_connection.invoke({ ..., sourceOutputIndex: 0 });
Defensive patterns

Strategy: validation

Validate before calling

// Check the branch at sourceOutputIndex before removing.
const branches = workflow.connections[sourceNode.name]?.[connectionType] ?? [];
if (!Array.isArray(branches[sourceOutputIndex]) || branches[sourceOutputIndex].length === 0) {
  // pick a populated index or default to 0
}

Try / catch

const res = await remove_connection.invoke(input);
if (isToolError(res) && res.code === 'OUTPUT_INDEX_NOT_FOUND') {
  // lower sourceOutputIndex or inspect the node's outputs
}

Prevention

When it happens

Trigger: Calling remove_connection with sourceOutputIndex: 1 when only index 0 has connections; off-by-one in index selection.

Common situations: IF node false-branch (index 1) was never wired; Switch node rule index miscounted; the branch was already disconnected.

Related errors


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