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

  1. Use only supported operators: 'eq', 'ne', 'in', 'nin'.
  2. For substring/contains needs, filter post-query client-side since the backend only supports equality/set membership.
  3. 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

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


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/fdaa0588f76e9120. Report an issue: GitHub.