{"record":{"id":"39a5d11ea6078066","repo":"mem0ai/mem0","slug":"unsupported-s3-vectors-filter-operator-operator","errorCode":null,"errorMessage":"Unsupported S3 Vectors filter operator: ${operator}","messagePattern":"Unsupported S3 Vectors filter operator: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mem0-ts/src/oss/src/vector_stores/s3_vectors.ts","lineNumber":640,"sourceCode":"          if (!Array.isArray(operand) || operand.length === 0) {\n            return { [ALWAYS_FALSE_FILTER_KEY]: true };\n          }\n          operators.$in = operand;\n          break;\n        case \"nin\":\n          if (!Array.isArray(operand) || operand.length === 0) {\n            break;\n          }\n          operators.$nin = operand;\n          break;\n        case \"contains\":\n        case \"icontains\":\n        case \"startsWith\":\n          throw new Error(\n            `S3 Vectors does not support '${operator}' metadata filters.`,\n          );\n        default:\n          throw new Error(\n            `Unsupported S3 Vectors filter operator: ${operator}`,\n          );\n      }\n    }\n\n    if (Object.keys(operators).length === 0) {\n      return {};\n    }\n    return { [key]: operators };\n  }\n\n  private negateFilter(filter: S3Filter): S3Filter {\n    if (Array.isArray(filter.$and)) {\n      return {\n        $or: filter.$and.map((entry: S3Filter) => this.negateFilter(entry)),\n      };\n    }\n","sourceCodeStart":622,"sourceCodeEnd":658,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/vector_stores/s3_vectors.ts#L622-L658","documentation":"While converting a metadata filter object to the S3 Vectors format, the store encountered an operator key it does not know at all (not eq, ne, gt, gte, lt, lte, in, nin, contains/icontains/startsWith, which have their own dedicated error). This is a fail-fast guard against typos and unsupported filter shapes so that filters are never silently dropped.","triggerScenarios":"Passing a filter operator like { endsWith: \"x\" }, { regex: \"...\" }, { size: 5 }, or a typo like { gteq: 10 } in filters for an S3 Vectors-backed Memory instance. Any operator key outside the recognized set hits the default case and throws.","commonSituations":"Typos in operator names; filters written for a different backend (Mongo-style $gt with dollar prefix, Pinecone-style $in) passed to S3 Vectors; new operators added to shared filter code without per-store support.","solutions":["Check the operator key in your filter and correct it to a supported one: eq, ne, gt, gte, lt, lte, in, nin.","Strip the dollar prefix if you copied Mongo-style filters ($gt -> gt, $in -> in).","Validate filter keys against the supported set before calling search (see defense strategy)."],"exampleFix":"// before\nawait memory.search(\"q\", { filters: { ts: { $gte: 100 } } }); // Mongo-style keys\n\n// after\nawait memory.search(\"q\", { filters: { ts: { gte: 100 } } });","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set([\"eq\",\"ne\",\"gt\",\"gte\",\"lt\",\"lte\",\"in\",\"nin\"]);\nfunction validateFilterOperators(filters: any): string[] {\n  const bad: string[] = [];\n  const walk = (f: any) => {\n    for (const [k, v] of Object.entries(f ?? {})) {\n      if ([\"AND\",\"OR\",\"NOT\"].includes(k)) { (v as any[]).forEach(walk); continue; }\n      if (v && typeof v === \"object\" && !Array.isArray(v))\n        for (const op of Object.keys(v)) if (!SUPPORTED.has(op)) bad.push(op);\n    }\n  };\n  walk(filters); return bad;\n}\nconst bad = validateFilterOperators(filters); if (bad.length) throw new Error(`Unknown operators: ${bad.join(', ')}`);","typeGuard":"type S3Operator = 'eq'|'ne'|'gt'|'gte'|'lt'|'lte'|'in'|'nin';\nconst isS3Operator = (op: string): op is S3Operator => new Set(['eq','ne','gt','gte','lt','lte','in','nin']).has(op);","tryCatchPattern":"try { await memory.search(q, { filters }); } catch (e) { if (e instanceof Error && e.message.startsWith('Unsupported S3 Vectors filter operator')) { /* log filter keys, fix typo */ } else throw e; }","preventionTips":["Never copy Mongo $-style operators into mem0 filters","Centralize filter construction in one validated helper","Type filter objects against a literal union of operators"],"tags":["s3-vectors","filters","validation","typescript"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}