{"record":{"id":"c703a4395af8fc88","repo":"mem0ai/mem0","slug":"or-filter-value-must-be-a-list-of-filter-dicts-go","errorCode":null,"errorMessage":"OR filter value must be a list of filter dicts, got ${typeof value}","messagePattern":"OR filter value must be a list of filter dicts, got (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mem0-ts/src/oss/src/vector_stores/cassandra.ts","lineNumber":555,"sourceCode":"    }\n\n    for (const [key, value] of Object.entries(normalized)) {\n      if (key === \"AND\") {\n        if (!Array.isArray(value)) {\n          throw new Error(\n            `AND filter value must be a list of filter dicts, got ${typeof value}`,\n          );\n        }\n        if (\n          !value.every((entry: SearchFilters) =>\n            this.filterVector(vector, entry),\n          )\n        ) {\n          return false;\n        }\n      } else if (key === \"OR\") {\n        if (!Array.isArray(value)) {\n          throw new Error(\n            `OR filter value must be a list of filter dicts, got ${typeof value}`,\n          );\n        }\n        if (\n          !value.some((entry: SearchFilters) =>\n            this.filterVector(vector, entry),\n          )\n        ) {\n          return false;\n        }\n      } else if (key === \"NOT\") {\n        if (!Array.isArray(value)) {\n          throw new Error(\n            `NOT filter value must be a list of filter dicts, got ${typeof value}`,\n          );\n        }\n        if (\n          !value.every(","sourceCodeStart":537,"sourceCodeEnd":573,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/vector_stores/cassandra.ts#L537-L573","documentation":"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.","triggerScenarios":"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> }.","commonSituations":"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.","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"],"exampleFix":"// before\nmemory.search('q', { filters: { OR: { user_id: 'a', agent: 'b' } } });\n\n// after\nmemory.search('q', { filters: { OR: [{ user_id: 'a' }, { agent: 'b' }] } });","handlingStrategy":"type-guard","validationCode":"if (filters.OR && !Array.isArray(filters.OR)) throw new Error('OR must be an array of filter dicts');","typeGuard":"const isFilterDictArray = (v: unknown): v is Record<string, any>[] =>\n  Array.isArray(v) && v.every((e) => e !== null && typeof e === 'object' && !Array.isArray(e));","tryCatchPattern":null,"preventionTips":["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"],"tags":["cassandra","filters","validation","typescript"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}