mem0ai/mem0 · error · Error
NOT filter value must be a list of filter dicts, got ${typeo
Error message
NOT filter value must be a list of filter dicts, got ${typeof value} What it means
filterVector() throws when a NOT filter key holds a non-array value. NOT is evaluated as .every() over sub-filters that must each NOT match; a non-array value cannot be iterated and is rejected as a malformed filter.
Source
Thrown at mem0-ts/src/oss/src/vector_stores/databricks.ts:1609
) {
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(
(entry: SearchFilters) => !this.filterVector(vector, entry),
)
) {
return false;
}
} else if (!this.matchFieldCondition(vector, key, value)) {
return false;
}
}
return true;
}
}View on GitHub (pinned to 001c235229)
Solutions
- Wrap the negated filter(s) in an array: { NOT: [{ user_id: 'u1' }] }.
- Centralize filter construction in a small builder function that type-checks compound branches.
- Check the SearchFilters type docs for AND/OR/NOT array semantics.
Example fix
// before
store.search(query, 5, { NOT: { user_id: 'u1' } });
// after
store.search(query, 5, { NOT: [{ user_id: 'u1' }] }); Defensive patterns
Strategy: type-guard
Validate before calling
if ('NOT' in filters && !Array.isArray((filters as any).NOT)) {
throw new Error('NOT branch must be an array of filter dicts');
} Type guard
const isValidNotBranch = (f: unknown) => !(typeof f === 'object' && f !== null && 'NOT' in f) || Array.isArray((f as any).NOT);
Try / catch
try {
await store.search(q, k, filters);
} catch (e) {
if (e instanceof Error && e.message.includes('NOT filter value must be a list')) {
// wrap the NOT value in an array and retry
}
throw e;
} Prevention
- Wrap negated filters in arrays: { NOT: [{ ... }] }.
- Do not assume NOT takes a single object — this SDK differs from some others.
- Type your filter variables to force array branches at compile time.
When it happens
Trigger: Calling search()/list() with { NOT: { user_id: 'u1' } } instead of { NOT: [{ user_id: 'u1' }] }.
Common situations: Assuming NOT takes a single filter object (common convention elsewhere); filter builders emitting a bare object for negation; copy-paste from other vector store SDKs.
Related errors
- AND filter value must be a list of filter dicts, got ${typeo
- OR filter value must be a list of filter dicts, got ${typeof
- AND filter value must be a list of filter dicts, got ${typeo
- OR filter value must be a list of filter dicts, got ${typeof
- NOT filter value must be a list of filter dicts, got ${typeo
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/6817626d3d76a7b5.
Report an issue: GitHub.