{"record":{"id":"7942d0c1dd3bfc96","repo":"n8n-io/n8n","slug":"no-models-connected","errorCode":null,"errorMessage":"No models connected","messagePattern":"No models connected","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/ModelSelector/ModelSelector.node.ts","lineNumber":162,"sourceCode":"\t\t\tasync getModels(this: ILoadOptionsFunctions) {\n\t\t\t\tconst numberInputs = this.getCurrentNodeParameter('numberInputs') as number;\n\n\t\t\t\treturn Array.from({ length: numberInputs ?? 2 }, (_, i) => ({\n\t\t\t\t\tvalue: i + 1,\n\t\t\t\t\tname: `Model ${(i + 1).toString()}`,\n\t\t\t\t}));\n\t\t\t},\n\t\t},\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst models = (await this.getInputConnectionData(\n\t\t\tNodeConnectionTypes.AiLanguageModel,\n\t\t\titemIndex,\n\t\t)) as unknown[];\n\n\t\tif (!models || models.length === 0) {\n\t\t\tthrow new NodeOperationError(this.getNode(), 'No models connected', {\n\t\t\t\titemIndex,\n\t\t\t\tdescription: 'No models found in input connections',\n\t\t\t});\n\t\t}\n\t\tmodels.reverse();\n\n\t\tconst rules = this.getNodeParameter('rules.rule', itemIndex, []) as ModeleSelectionRule[];\n\n\t\tif (!rules || rules.length === 0) {\n\t\t\tthrow new NodeOperationError(this.getNode(), 'No rules defined', {\n\t\t\t\titemIndex,\n\t\t\t\tdescription: 'At least one rule must be defined to select a model',\n\t\t\t});\n\t\t}\n\n\t\tfor (let i = 0; i < rules.length; i++) {\n\t\t\tconst rule = rules[i];\n\t\t\tconst modelIndex = rule.modelIndex;","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/ModelSelector/ModelSelector.node.ts#L144-L180","documentation":"Thrown by the ModelSelector node's supplyData() when getInputConnectionData for AiLanguageModel returns no models. The node routes between multiple connected models based on rules, so at least one model connection is mandatory; zero models means there is nothing to select from.","triggerScenarios":"supplyData() awaits the AiLanguageModel input connections and checks `if (!models || models.length === 0)`. Fires when no Chat Model nodes are connected to the ModelSelector, when all connected model nodes failed to supply data, or when the connection type is wrong.","commonSituations":"Forgetting to connect any model to the ModelSelector; connecting a non-language-model node to the model input; connected model nodes that resolve to an empty array due to upstream errors.","solutions":["Connect one or more Chat Model nodes to the ModelSelector's AiLanguageModel input.","Verify each connected node is a language/chat model and executes without error.","Remove stale/broken connections and re-add them so supplyData resolves a non-empty array."],"exampleFix":"// before: ModelSelector has rules but no model nodes attached\n// after: attach one Chat Model node per rule.modelIndex referenced","handlingStrategy":"validation","validationCode":"const models = await getInputConnectionData(NodeConnectionTypes.AiLanguageModel, itemIndex);\nif (!Array.isArray(models) || models.length === 0) throw new Error('Connect at least one Chat Model');","typeGuard":"function hasModels(m): m is unknown[] { return Array.isArray(m) && m.length > 0; }","tryCatchPattern":null,"preventionTips":["Always connect at least one Chat Model node to ModelSelector.","Validate connections in the editor's execute-once preview.","Remove and re-add connections if a model node stops supplying data."],"tags":["model-selector","langchain","connections","config"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}