{"record":{"id":"c919c3026d5bdf74","repo":"n8n-io/n8n","slug":"please-connect-a-model-to-the-fallback-model-input-c919c3","errorCode":null,"errorMessage":"Please connect a model to the Fallback Model input or disable the fallback option","messagePattern":"Please connect a model to the Fallback Model input or disable the fallback option","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V3/helpers/buildExecutionContext.ts","lineNumber":49,"sourceCode":"): Promise<ToolsAgentExecutionContext> {\n\tconst items = ctx.getInputData();\n\tconst batchSize = ctx.getNodeParameter('options.batching.batchSize', 0, 1) as number;\n\tconst delayBetweenBatches = ctx.getNodeParameter(\n\t\t'options.batching.delayBetweenBatches',\n\t\t0,\n\t\t0,\n\t) as number;\n\tconst needsFallback = ctx.getNodeParameter('needsFallback', 0, false) as boolean;\n\n\tconst memory = await getOptionalMemory(ctx);\n\tconst model = await getChatModel(ctx, 0);\n\tassert(model, 'Please connect a model to the Chat Model input');\n\n\tlet fallbackModel: BaseChatModel | null = null;\n\tif (needsFallback) {\n\t\tconst maybeFallbackModel = await getChatModel(ctx, 1);\n\t\tif (!maybeFallbackModel) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tctx.getNode(),\n\t\t\t\t'Please connect a model to the Fallback Model input or disable the fallback option',\n\t\t\t);\n\t\t}\n\t\tfallbackModel = maybeFallbackModel;\n\t}\n\n\treturn {\n\t\titems,\n\t\tbatchSize,\n\t\tdelayBetweenBatches,\n\t\tneedsFallback,\n\t\tmodel,\n\t\tfallbackModel,\n\t\tmemory,\n\t};\n}\n","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V3/helpers/buildExecutionContext.ts#L31-L67","documentation":"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.","triggerScenarios":"Tools Agent V3 with the fallback option enabled and no model node connected to the Fallback Model input.","commonSituations":"Option toggled without wiring the input; fallback model node deleted; fallback model node errored during getInputConnectionData.","solutions":["Connect a chat model to the Fallback Model input.","Disable the needsFallback option if fallback is not required.","Confirm the fallback model node loads correctly on its own."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const needsFallback = ctx.getNodeParameter('needsFallback', 0, false) as boolean;\nif (needsFallback) {\n  const fb = await getChatModel(ctx, 1);\n  if (!fb) {\n    throw new NodeOperationError(ctx.getNode(), 'Fallback enabled but no model connected to the Fallback Model input.');\n  }\n}","typeGuard":"function isChatModel(model: unknown): model is BaseChatModel {\n  return !!model && typeof (model as any).invoke === 'function';\n}","tryCatchPattern":null,"preventionTips":["Wire the Fallback Model input whenever needsFallback is true.","Disable needsFallback if no fallback is needed.","Test fallback model loading independently."],"tags":["langchain","agent","tools-agent","fallback","configuration","v3"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}