n8n-io/n8n · error · Error

Cannot call .input() on the workflow builder. Use .input() o

Error message

Cannot call .input() on the workflow builder. Use .input() on a node variable instead: myNode.input(1)

What it means

Symmetric to the .output() guard: the WorkflowBuilder object has no .input(). Input selection is a node-level concept (selecting which input index of a node to wire into). The method is defined on the builder solely to throw a guiding error when a caller writes workflow.input(1) instead of myNode.input(1).

Source

Thrown at packages/@n8n/workflow-sdk/src/workflow-builder.ts:457

		this._currentNode = sourceKey;
		this._currentOutput = outputIndex;
		this.to(target as NodeInstance<string, string, unknown>);
		// Re-anchor the cursor on the branching node so the next sibling branch wires correctly.
		this._currentNode = sourceKey;
		this._currentOutput = 0;
		return this;
	}

	output(): never {
		throw new Error(
			'Cannot call .output() on the workflow builder. ' +
				'Use .output() on a node variable instead: myNode.output(0).to(targetNode)',
		);
	}

	input(): never {
		throw new Error(
			'Cannot call .input() on the workflow builder. ' +
				'Use .input() on a node variable instead: myNode.input(1)',
		);
	}

	settings(settings: WorkflowSettings): WorkflowBuilder {
		this._settings = { ...this._settings, ...settings };
		return this;
	}

	connect(
		source: NodeInstance<string, string, unknown>,
		sourceOutput: number,
		target: NodeInstance<string, string, unknown>,
		targetInput: number,
	): WorkflowBuilder {
		// Ensure both nodes exist in the graph
		if (!this._nodes.has(source.name)) {

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Call .input(index) on the node handle: myNode.input(1).to(...) or pass it to workflow.add().
  2. Re-confirm the node variable is in scope before chaining.

Example fix

// before
workflow.input(1).to(target); // throws

// after
const myNode = node({ type: 'Merge' });
workflow.add(myNode.input(1).to(target));
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof (wf as any).input === 'function') {
  // .input() on the builder always throws; call it on a node handle instead.
}
const myNode = node({ type: 'Merge' });
const selector = myNode.input(1); // correct

Type guard

function isWorkflowBuilder(v: unknown): v is WorkflowBuilder {
  return typeof v === 'object' && v !== null && 'add' in v && 'to' in v && 'settings' in v;
}

Prevention

When it happens

Trigger: Typing workflow.input(1) instead of node.input(1). Typically arises when wiring a target's input index and the caller applies the call to the workflow rather than the node handle.

Common situations: Misreading fluent chain examples; autocomplete selecting the workflow's input() stub over the node's; refactoring that detaches the node variable.

Related errors


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