{"record":{"id":"6817626d3d76a7b5","repo":"mem0ai/mem0","slug":"not-filter-value-must-be-a-list-of-filter-dicts-g-681762","errorCode":null,"errorMessage":"NOT filter value must be a list of filter dicts, got ${typeof value}","messagePattern":"NOT 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/databricks.ts","lineNumber":1609,"sourceCode":"        ) {\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(\n            (entry: SearchFilters) => !this.filterVector(vector, entry),\n          )\n        ) {\n          return false;\n        }\n      } else if (!this.matchFieldCondition(vector, key, value)) {\n        return false;\n      }\n    }\n\n    return true;\n  }\n}","sourceCodeStart":1591,"sourceCodeEnd":1627,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/vector_stores/databricks.ts#L1591-L1627","documentation":"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.","triggerScenarios":"Calling search()/list() with { NOT: { user_id: 'u1' } } instead of { NOT: [{ user_id: 'u1' }] }.","commonSituations":"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.","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."],"exampleFix":"// before\nstore.search(query, 5, { NOT: { user_id: 'u1' } });\n\n// after\nstore.search(query, 5, { NOT: [{ user_id: 'u1' }] });","handlingStrategy":"type-guard","validationCode":"if ('NOT' in filters && !Array.isArray((filters as any).NOT)) {\n  throw new Error('NOT branch must be an array of filter dicts');\n}","typeGuard":"const isValidNotBranch = (f: unknown) =>\n  !(typeof f === 'object' && f !== null && 'NOT' in f) || Array.isArray((f as any).NOT);","tryCatchPattern":"try {\n  await store.search(q, k, filters);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('NOT filter value must be a list')) {\n    // wrap the NOT value in an array and retry\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["databricks","filters","validation","vector-store","typescript"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}