{"record":{"id":"b00fdfc95ad5f020","repo":"mem0ai/mem0","slug":"unsupported-metadata-filter-operator-operator","errorCode":null,"errorMessage":"Unsupported metadata filter operator: ${operator}","messagePattern":"Unsupported metadata filter operator: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mem0-ts/src/oss/src/memory/index.ts","lineNumber":2141,"sourceCode":"        ne: \"ne\",\n        gt: \"gt\",\n        gte: \"gte\",\n        lt: \"lt\",\n        lte: \"lte\",\n        in: \"in\",\n        nin: \"nin\",\n        contains: \"contains\",\n        icontains: \"icontains\",\n      };\n\n      for (const [operator, value] of Object.entries(condition)) {\n        if (operator in operatorMap) {\n          if (!result[key]) {\n            result[key] = {};\n          }\n          result[key][operatorMap[operator]] = value;\n        } else {\n          throw new Error(`Unsupported metadata filter operator: ${operator}`);\n        }\n      }\n      return result;\n    };\n\n    for (const [key, value] of Object.entries(metadataFilters)) {\n      if (key === \"AND\") {\n        // Logical AND: combine multiple conditions\n        if (!Array.isArray(value)) {\n          throw new Error(\"AND operator requires a list of conditions\");\n        }\n        for (const condition of value) {\n          for (const [subKey, subValue] of Object.entries(condition)) {\n            Object.assign(processedFilters, processCondition(subKey, subValue));\n          }\n        }\n      } else if (key === \"OR\") {\n        // Logical OR: Pass through to vector store for implementation-specific handling","sourceCodeStart":2123,"sourceCodeEnd":2159,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/memory/index.ts#L2123-L2159","documentation":"Thrown while processing config.metadataFilters (in add/search filter preprocessing) when a condition object uses an operator key outside the supported map: equals, neq, gt, gte, lt, lte, in, nin, contains, icontains. The operator names are passed through to the vector store, so unknown operators are rejected rather than silently dropped.","triggerScenarios":"Writing a condition like { created_at: { eq: '2024-01-01' } } (eq is not supported — it is equals), or { tag: { like: 'x' } }, or { count: { >: 5 } } (symbol keys are not operators).","commonSituations":"Translating SQL/Mongo intuition (eq, like, $gt) to Mem0's operator names; version drift if operator names changed between releases; typos in dynamic filter construction.","solutions":["Use only the supported operators: equals, neq, gt, gte, lt, lte, in, nin, contains, icontains","Replace eq with equals and like with icontains (case-insensitive contains)","If building filters dynamically, validate operator keys against the allowed set before calling the SDK"],"exampleFix":"// before\nfilters: { user_id: 'u1', AND: [{ created_at: { eq: '2024-01-01' } }] }\n\n// after\nfilters: { user_id: 'u1', AND: [{ created_at: { equals: '2024-01-01' } }] }","handlingStrategy":"type-guard","validationCode":"const OPS = new Set(['equals','neq','gt','gte','lt','lte','in','nin','contains','icontains']);\nfunction assertOperators(filters: Record<string, unknown>) {\n  for (const v of Object.values(filters)) {\n    for (const op of Object.keys(v as object)) {\n      if (!OPS.has(op)) throw new Error(`unknown filter operator: ${op}`);\n    }\n  }\n}","typeGuard":"const isSupportedOperator = (op: string): op is 'equals'|'neq'|'gt'|'gte'|'lt'|'lte'|'in'|'nin'|'contains'|'icontains' =>\n  ['equals','neq','gt','gte','lt','lte','in','nin','contains','icontains'].includes(op as never);","tryCatchPattern":null,"preventionTips":["Memorize the operator list: equals, neq, gt, gte, lt, lte, in, nin, contains, icontains — no eq, no like, no $ prefixes","Validate dynamically built filters against the allowed set in one shared helper"],"tags":["validation","oss","filters","metadata"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}