mem0ai/mem0 · error · Error
OR filter value must be a list of filter dicts, got ${typeof
Error message
OR filter value must be a list of filter dicts, got ${typeof value} What it means
In filterVector(), an 'OR' key must map to an array of filter objects; each entry is evaluated and the results ORed. Any non-array value (object, string, number) throws with the actual typeof so the caller can see the shape mistake.
Source
Thrown at mem0-ts/src/oss/src/vector_stores/cassandra.ts:555
}
for (const [key, value] of Object.entries(normalized)) {
if (key === "AND") {
if (!Array.isArray(value)) {
throw new Error(
`AND filter value must be a list of filter dicts, got ${typeof value}`,
);
}
if (
!value.every((entry: SearchFilters) =>
this.filterVector(vector, entry),
)
) {
return false;
}
} else if (key === "OR") {
if (!Array.isArray(value)) {
throw new Error(
`OR filter value must be a list of filter dicts, got ${typeof value}`,
);
}
if (
!value.some((entry: SearchFilters) =>
this.filterVector(vector, entry),
)
) {
return false;
}
} else if (key === "NOT") {
if (!Array.isArray(value)) {
throw new Error(
`NOT filter value must be a list of filter dicts, got ${typeof value}`,
);
}
if (
!value.every(View on GitHub (pinned to 001c235229)
Solutions
- Use an array of filter dicts: { OR: [{ user_id: 'a' }, { user_id: 'b' }] }
- Keep every entry a filter object, not a string or primitive
Example fix
// before
memory.search('q', { filters: { OR: { user_id: 'a', agent: 'b' } } });
// after
memory.search('q', { filters: { OR: [{ user_id: 'a' }, { agent: 'b' }] } }); Defensive patterns
Strategy: type-guard
Validate before calling
if (filters.OR && !Array.isArray(filters.OR)) throw new Error('OR must be an array of filter dicts'); Type guard
const isFilterDictArray = (v: unknown): v is Record<string, any>[] => Array.isArray(v) && v.every((e) => e !== null && typeof e === 'object' && !Array.isArray(e));
Prevention
- Type filters against the store's SearchFilters type so the compiler catches object-shaped combinators
- Keep combinator values as arrays even with a single entry
When it happens
Trigger: Calling search/list with filters like { OR: { user_id: 'a' } } or { OR: ['user_id=a'] } (array of strings, not filter dicts — passes the Array.isArray check but then fails inside) — the direct throw is { OR: <non-array> }.
Common situations: Mixing up OR-shape between vector stores (some accept an object); building filters from query params where OR arrives as a single object; assuming OR works like Mongo's $or with a single object.
Related errors
- AND filter value must be a list of filter dicts, got ${typeo
- NOT filter value must be a list of filter dicts, got ${typeo
- 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/c703a4395af8fc88.
Report an issue: GitHub.