n8n-io/n8n · error · Error
Invalid filter operator "${operator}" for key "${key}". Supp
Error message
Invalid filter operator "${operator}" for key "${key}". Supported operators: ${FILTER_OPERATORS.join(', ')} What it means
assertValidCondition rejects any filter condition whose operator is not in FILTER_OPERATORS (eq, ne, in, nin). The validator runs on every condition in a VectorFilter before the search backend sees it, so unsupported operators never reach the vector store — they fail loudly instead of silently behaving as eq or being dropped.
Source
Thrown at packages/@n8n/agents/src/sdk/vector-store-filter.ts:43
key,
operator: 'eq',
value,
}));
return { conditions, combineWith: 'and' };
}
/** Validates operator/value pairing per condition; throws rather than silently ignoring a bad filter. */
export function assertValidFilter(filter: VectorFilter): void {
for (const condition of filter.conditions) {
assertValidCondition(condition);
}
}
function assertValidCondition(condition: FilterCondition): void {
const { key, operator, value } = condition;
if (!(FILTER_OPERATORS as readonly string[]).includes(operator)) {
throw new Error(
`Invalid filter operator "${operator}" for key "${key}". Supported operators: ${FILTER_OPERATORS.join(', ')}`,
);
}
if (operator === 'in' || operator === 'nin') {
if (!Array.isArray(value) || value.length === 0) {
throw new Error(
`Filter operator "${operator}" on key "${key}" requires a non-empty array value.`,
);
}
if (value.some((v) => typeof v !== 'string' && typeof v !== 'number')) {
throw new Error(
`Filter operator "${operator}" on key "${key}" requires array elements to be strings or numbers.`,
);
}
return;
}
View on GitHub (pinned to 5ac6606e81)
Solutions
- Use only supported operators: 'eq', 'ne', 'in', 'nin'.
- For substring/contains needs, filter post-query client-side since the backend only supports equality/set membership.
- When building filters from user input, validate the operator against FILTER_OPERATORS (exported) before constructing the condition.
Example fix
// before
store.search('q', {
filter: { conditions: [{ key: 'tag', operator: 'contains', value: 'x' }], combineWith: 'and' },
}); // throws
// after
store.search('q', {
filter: { conditions: [{ key: 'tag', operator: 'eq', value: 'x' }], combineWith: 'and' },
}); Defensive patterns
Strategy: validation
Validate before calling
import { FILTER_OPERATORS } from '@n8n/agents/sdk/vector-store-filter';
function buildCondition(key: string, operator: string, value: unknown) {
if (!(FILTER_OPERATORS as readonly string[]).includes(operator)) {
throw new Error(`Unsupported operator ${operator}. Use one of: ${FILTER_OPERATORS.join(', ')}`);
}
return { key, operator, value } as const;
} Type guard
import { FILTER_OPERATORS } from '@n8n/agents/sdk/vector-store-filter';
function isValidFilterOperator(op: unknown): op is typeof FILTER_OPERATORS[number] {
return typeof op === 'string' && (FILTER_OPERATORS as readonly string[]).includes(op);
} Prevention
- Restrict the operator set at the UI/API boundary so users cannot submit unknown operators.
- Map foreign query syntax (SQL, Mongo) to the four supported operators explicitly.
- Reuse the exported FILTER_OPERATORS constant for any allow-list check.
When it happens
Trigger: Calling vectorStore.search(query, { filter: { conditions: [{ key: 'tag', operator: 'contains', value: 'x' }], combineWith: 'and' } }) or the shorthand { tag: 'x' } (always eq, safe) with an operator typo like 'equal', 'not_equal', 'within'. Also hit by constructing a VectorFilter programmatically with a string not in the allowed set.
Common situations: Translating filter syntax from another query language (SQL LIKE, Mongo $eq, Pinecone semantics) into this API's operator vocabulary; typos; building filters from user input without restricting the operator set.
Related errors
- filterableKeys must contain at least one key
- Filter operator "${operator}" on key "${key}" requires a non
- Filter operator "${operator}" on key "${key}" requires array
- Filter operator "${operator}" on key "${key}" requires a str
- VectorStore "${this.name}" requires a description — set it v
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/fdaa0588f76e9120.
Report an issue: GitHub.