n8n-io/n8n · error · NodeOperationError
No matching rule found
Error message
No matching rule found
What it means
Thrown by ModelSelector.supplyData() after iterating all rules without any rule's conditions evaluating to true. The node returns the first matching rule's model; if none match, it cannot choose and throws. This is a configuration/policy miss, not a runtime fault.
Source
Thrown at packages/@n8n/nodes-langchain/nodes/ModelSelector/ModelSelector.node.ts:212
const selectedModel = models[modelIndex - 1] as BaseChatModel;
const originalCallbacks = getCallbacksArray(selectedModel.callbacks);
for (const currentCallback of originalCallbacks) {
if (currentCallback instanceof N8nLlmTracing) {
currentCallback.setParentRunIndex(this.getNextRunIndex());
}
}
const modelSelectorTracing = new N8nNonEstimatingTracing(this);
selectedModel.callbacks = [...originalCallbacks, modelSelectorTracing];
return {
response: selectedModel,
};
}
}
throw new NodeOperationError(this.getNode(), 'No matching rule found', {
itemIndex,
description: 'None of the defined rules matched the workflow data',
});
}
}
View on GitHub (pinned to 5ac6606e81)
Solutions
- Add a final catch-all rule (always-true condition) that selects a default model so selection never falls through.
- Loosen or fix the existing conditions to match the actual runtime data shape.
- Inspect the incoming item data at runtime to see why no condition matched.
Example fix
// before: rules only match when input.category === 'fast' // after: append a fallback rule with no conditions (or always-true) selecting a default model
Defensive patterns
Strategy: fallback
Validate before calling
const hasCatchAll = rules.some((r) => isAlwaysTrue(r.conditions));
if (!hasCatchAll) throw new Error('Add a default rule to avoid No matching rule found'); Prevention
- Always add a final always-true rule as the default model selection.
- Keep rule conditions aligned with the runtime data shape.
- Log item data before the ModelSelector to diagnose misses.
When it happens
Trigger: The for-loop over rules evaluates `conditionsMet` for each rule via getNodeParameter with extractValue. If no rule's conditions are met, execution falls through to the throw. Fires when workflow data does not satisfy any rule predicate.
Common situations: Conditions narrower than the data the workflow actually produces (e.g. expecting a field that is absent); rules built for a different input shape; no catch-all/else rule defined.
Related errors
- No rules defined
- No models connected
- Invalid model index ${modelIndex}
- Reflector output did not contain a JSON object
- MCP server "${cfg.name}": exactly one of "url" or "command"
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/f405ce26c629d2ae.
Report an issue: GitHub.