{"record":{"id":"7a6d86ea873b8320","repo":"n8n-io/n8n","slug":"please-connect-a-model-to-the-fallback-model-input-7a6d86","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":"validation","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vendors/Microsoft/langchain-utils.ts","lineNumber":48,"sourceCode":"\tconst conversationId = (invokeOptions.configurable as { thread_id?: string } | undefined)\n\t\t?.thread_id;\n\tif (conversationId) {\n\t\tconst req = nodeContext.getRequestObject();\n\t\tif (req.body && typeof req.body === 'object') {\n\t\t\t(req.body as Record<string, unknown>).sessionId = conversationId;\n\t\t}\n\t}\n\n\tconst needsFallback = nodeContext.getNodeParameter('needsFallback', false) as boolean;\n\tconst memory = await getOptionalMemory(nodeContext);\n\tconst model = await getChatModel(nodeContext, 0);\n\n\tassert(model, 'Please connect a model to the Chat Model input');\n\n\tconst fallbackModel = needsFallback ? await getChatModel(nodeContext, 1) : null;\n\n\tif (needsFallback && !fallbackModel) {\n\t\tthrow new NodeOperationError(\n\t\t\tnodeContext.getNode(),\n\t\t\t'Please connect a model to the Fallback Model input or disable the fallback option',\n\t\t);\n\t}\n\n\tconst outputParser = await getOptionalOutputParser(nodeContext, 0);\n\tlet tools = await getTools(nodeContext, outputParser);\n\n\tif (microsoftMcpToolkits?.length) {\n\t\ttools = tools.concat(microsoftMcpToolkits.flatMap((toolkit) => toolkit.tools));\n\t}\n\n\tconst options = nodeContext.getNodeParameter('options', {}) as {\n\t\tsystemMessage?: string;\n\t\tmaxIterations?: number;\n\t};\n\n\tif (systemMessage) {","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vendors/Microsoft/langchain-utils.ts#L30-L66","documentation":"Configuration guard in invokeAgent (Microsoft Tools Agent). If the 'needsFallback' parameter is true but no chat model is connected to the second (Fallback Model) input, the agent cannot construct a fallback-aware executor and refuses to run. Note the primary model is already asserted just above via assert(model, 'Please connect a model to the Chat Model input').","triggerScenarios":"needsFallback is enabled in the node options and the Fallback Model input (input index 1) has no incoming connection — e.g. user toggled the option but didn't wire a second AI Model node, or disconnected it during editing.","commonSituations":"Building a fault-tolerant agent, enabling fallback, then forgetting to attach the fallback model node; copying a node that referenced a deleted model; the fallback node is on a disabled branch.","solutions":["Connect an AI Model node to the Fallback Model input, or","If you don't need fallback, turn off the 'needsFallback' option in the node settings.","Ensure the connected fallback node is enabled and on a reachable branch."],"exampleFix":"// before\nconst needsFallback = true;\nconst fallbackModel = null; // nothing connected to input 1\n\n// after — either disable fallback\nconst needsFallback = false;\n// or wire a model: connect an OpenAI/Anthropic Chat Model node to input 1","handlingStrategy":"validation","validationCode":"const needsFallback = Boolean(nodeContext.getNodeParameter('needsFallback', false));\nif (needsFallback) {\n  const fb = await getChatModel(nodeContext, 1).catch(() => null);\n  if (!fb) throw new Error('needsFallback is on but no Fallback Model is connected to input 1');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When toggling needsFallback on, immediately wire a second AI Model node to input 1.","If fallback isn't needed, leave needsFallback off rather than connecting nothing.","Keep the fallback node enabled and on a reachable branch."],"tags":["microsoft","langchain","agent","ai-model","fallback","validation","node-operation-error"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}