n8n-io/n8n · error · NodeOperationError

Please connect a model to the Fallback Model input or disabl

Error message

Please connect a model to the Fallback Model input or disable the fallback option

What it means

Thrown by Tools Agent V3's buildExecutionContext when needsFallback=true but getChatModel(ctx, 1) returned a falsy value. This is the V3 equivalent of error 651: the fallback input is enabled but nothing is connected to it.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V3/helpers/buildExecutionContext.ts:49

): Promise<ToolsAgentExecutionContext> {
	const items = ctx.getInputData();
	const batchSize = ctx.getNodeParameter('options.batching.batchSize', 0, 1) as number;
	const delayBetweenBatches = ctx.getNodeParameter(
		'options.batching.delayBetweenBatches',
		0,
		0,
	) as number;
	const needsFallback = ctx.getNodeParameter('needsFallback', 0, false) as boolean;

	const memory = await getOptionalMemory(ctx);
	const model = await getChatModel(ctx, 0);
	assert(model, 'Please connect a model to the Chat Model input');

	let fallbackModel: BaseChatModel | null = null;
	if (needsFallback) {
		const maybeFallbackModel = await getChatModel(ctx, 1);
		if (!maybeFallbackModel) {
			throw new NodeOperationError(
				ctx.getNode(),
				'Please connect a model to the Fallback Model input or disable the fallback option',
			);
		}
		fallbackModel = maybeFallbackModel;
	}

	return {
		items,
		batchSize,
		delayBetweenBatches,
		needsFallback,
		model,
		fallbackModel,
		memory,
	};
}

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Connect a chat model to the Fallback Model input.
  2. Disable the needsFallback option if fallback is not required.
  3. Confirm the fallback model node loads correctly on its own.
Defensive patterns

Strategy: validation

Validate before calling

const needsFallback = ctx.getNodeParameter('needsFallback', 0, false) as boolean;
if (needsFallback) {
  const fb = await getChatModel(ctx, 1);
  if (!fb) {
    throw new NodeOperationError(ctx.getNode(), 'Fallback enabled but no model connected to the Fallback Model input.');
  }
}

Type guard

function isChatModel(model: unknown): model is BaseChatModel {
  return !!model && typeof (model as any).invoke === 'function';
}

Prevention

When it happens

Trigger: Tools Agent V3 with the fallback option enabled and no model node connected to the Fallback Model input.

Common situations: Option toggled without wiring the input; fallback model node deleted; fallback model node errored during getInputConnectionData.

Related errors


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