n8n-io/n8n · error · NodeOperationError
No models connected
Error message
No models connected
What it means
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.
Source
Thrown at packages/@n8n/nodes-langchain/nodes/ModelSelector/ModelSelector.node.ts:162
async getModels(this: ILoadOptionsFunctions) {
const numberInputs = this.getCurrentNodeParameter('numberInputs') as number;
return Array.from({ length: numberInputs ?? 2 }, (_, i) => ({
value: i + 1,
name: `Model ${(i + 1).toString()}`,
}));
},
},
};
async supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {
const models = (await this.getInputConnectionData(
NodeConnectionTypes.AiLanguageModel,
itemIndex,
)) as unknown[];
if (!models || models.length === 0) {
throw new NodeOperationError(this.getNode(), 'No models connected', {
itemIndex,
description: 'No models found in input connections',
});
}
models.reverse();
const rules = this.getNodeParameter('rules.rule', itemIndex, []) as ModeleSelectionRule[];
if (!rules || rules.length === 0) {
throw new NodeOperationError(this.getNode(), 'No rules defined', {
itemIndex,
description: 'At least one rule must be defined to select a model',
});
}
for (let i = 0; i < rules.length; i++) {
const rule = rules[i];
const modelIndex = rule.modelIndex;View on GitHub (pinned to 5ac6606e81)
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.
Example fix
// before: ModelSelector has rules but no model nodes attached // after: attach one Chat Model node per rule.modelIndex referenced
Defensive patterns
Strategy: validation
Validate before calling
const models = await getInputConnectionData(NodeConnectionTypes.AiLanguageModel, itemIndex);
if (!Array.isArray(models) || models.length === 0) throw new Error('Connect at least one Chat Model'); Type guard
function hasModels(m): m is unknown[] { return Array.isArray(m) && m.length > 0; } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- No tool inputs found
- Reflector output must be valid JSON
- Chat Model is required
- No rules defined
- No matching rule found
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/7942d0c1dd3bfc96.
Report an issue: GitHub.