mem0ai/mem0 · error · Error
S3 Vectors does not support '${operator}' metadata filters.
Error message
S3 Vectors does not support '${operator}' metadata filters. What it means
The S3 Vectors vector store in mem0-ts throws this when converting a user-supplied metadata filter that uses the 'contains', 'icontains', or 'startsWith' operators. AWS S3 Vectors only supports equality, comparison, in/nin, and exists semantics on metadata, so substring matching cannot be pushed down to the service. The store fails fast at filter-conversion time instead of silently returning wrong results.
Source
Thrown at mem0-ts/src/oss/src/vector_stores/s3_vectors.ts:636
case "lte":
operators.$lte = operand;
break;
case "in":
if (!Array.isArray(operand) || operand.length === 0) {
return { [ALWAYS_FALSE_FILTER_KEY]: true };
}
operators.$in = operand;
break;
case "nin":
if (!Array.isArray(operand) || operand.length === 0) {
break;
}
operators.$nin = operand;
break;
case "contains":
case "icontains":
case "startsWith":
throw new Error(
`S3 Vectors does not support '${operator}' metadata filters.`,
);
default:
throw new Error(
`Unsupported S3 Vectors filter operator: ${operator}`,
);
}
}
if (Object.keys(operators).length === 0) {
return {};
}
return { [key]: operators };
}
private negateFilter(filter: S3Filter): S3Filter {
if (Array.isArray(filter.$and)) {
return {View on GitHub (pinned to 001c235229)
Solutions
- Rewrite the filter using supported operators: in/nin for value sets, eq/ne for exact matches, gte/lte/gt/lt for ranges, exists for presence.
- Do substring matching client-side: search with the broadest safe filter (e.g. eq on user_id) and post-filter the returned payloads in your code.
- If substring search on metadata is a hard requirement, switch to a vector store that supports it (e.g. Qdrant, Chroma) via the vectorStore config.
Example fix
// before
await memory.search("notes", { filters: { user_id: { contains: "alice" } } });
// after
const results = await memory.search("notes", { filters: { user_id: { eq: "alice-123" } } }); Defensive patterns
Strategy: validation
Validate before calling
const S3_UNSUPPORTED = new Set(["contains", "icontains", "startsWith"]);
function assertS3SafeFilter(filters: any): void {
for (const [k, v] of Object.entries(filters ?? {})) {
if (["AND", "OR", "NOT"].includes(k)) { (v as any[]).forEach(assertS3SafeFilter); continue; }
if (v && typeof v === "object" && !Array.isArray(v))
for (const op of Object.keys(v))
if (S3_UNSUPPORTED.has(op)) throw new Error(`Filter operator '${op}' unsupported on S3 Vectors; rewrite as in/eq`);
}
}
assertS3SafeFilter(myFilters); Type guard
function isS3SafeOperator(op: string): op is 'eq'|'ne'|'gt'|'gte'|'lt'|'lte'|'in'|'nin' {
return ['eq','ne','gt','gte','lt','lte','in','nin'].includes(op);
} Try / catch
try { await memory.search(q, { filters }); } catch (e) { if (e instanceof Error && e.message.includes('does not support') && e.message.includes('metadata filters')) { /* fall back to eq filter + client-side substring */ } else throw e; } Prevention
- Keep per-store filter profiles when multi-backend
- Prefer in/nin over substring operators for portable filters
- Post-filter payloads client-side for text matching
When it happens
Trigger: Calling memory.search(query, { filters: { user_id: { contains: 'alice' } } }) or any filter using contains/icontains/startsWith while vectorStore is configured as S3Vectors. Also triggered when an LLM-derived filter or upstream code constructs those operators generically across vector stores.
Common situations: Porting an app from Qdrant/Chroma (which support substring filters) to S3 Vectors; sharing filter-building code across multiple store backends; agent pipelines that auto-generate filters with string-matching operators.
Related errors
- Unsupported S3 Vectors filter operator: ${operator}
- S3 Vectors cannot negate this filter shape.
- Top-level entity parameters [${invalidKeys.join(", ")}] are
- Invalid ${name}: cannot be empty or whitespace-only. Provide
- Invalid ${name}: cannot contain whitespace. Provide a valid
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/ff91d98eb8402cfc.
Report an issue: GitHub.