{"record":{"id":"5c2b7da9bd95647d","repo":"chroma-core/chroma","slug":"unsupported-where-operator-operator","errorCode":null,"errorMessage":"Unsupported where operator: ${operator}","messagePattern":"Unsupported where operator: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clients/new-js/packages/chromadb/src/execution/expression/where.ts","lineNumber":231,"sourceCode":"    throw new Error(\"Where dictionary must contain exactly one field\");\n  }\n\n  const [field, value] = entries[0];\n  if (!isPlainObject(value)) {\n    return new ComparisonWhere(field, \"$eq\", value);\n  }\n\n  const operatorEntries = Object.entries(value);\n  if (operatorEntries.length !== 1) {\n    throw new Error(\n      `Operator dictionary for field \"${field}\" must contain exactly one operator`,\n    );\n  }\n\n  const [operator, operand] = operatorEntries[0];\n  const factory = comparisonOperatorMap.get(operator);\n  if (!factory) {\n    throw new Error(`Unsupported where operator: ${operator}`);\n  }\n\n  return factory(field, operand);\n};\n\nexport const createComparisonWhere = (\n  key: string,\n  operator: string,\n  value: unknown,\n): WhereExpression => new ComparisonWhere(key, operator, value);\n","sourceCodeStart":213,"sourceCodeEnd":242,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/new-js/packages/chromadb/src/execution/expression/where.ts#L213-L242","documentation":"The parser resolves each operator key against a fixed map that supports exactly: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $contains, $not_contains, $regex and $not_regex. Any other operator string inside an operator dictionary throws this error client-side. Notably there is no $between, $like, $exists or $size.","triggerScenarios":"where: { price: { $between: [10, 100] } }; Mongo-isms like { title: { $like: '%report%' } } or { tags: { $exists: true } }; casing or spelling typos like $GTE, $greter, $Contain.","commonSituations":"Translating MongoDB or SQL WHERE syntax to Chroma; using an operator added in a newer Chroma server version that this client's parser does not know; hand-typing operator strings without a shared constant.","solutions":["Replace $between with { $and: [{ f: { $gte: min } }, { f: { $lte: max } }] }.","Replace $like with $contains (substring) or $regex (pattern).","Drop $exists — model optional metadata explicitly or filter client-side.","Check spelling and case against the supported list: $eq $ne $gt $gte $lt $lte $in $nin $contains $not_contains $regex $not_regex."],"exampleFix":"// before\nwhere: { title: { $like: 'report' } }\n\n// after\nwhere: { title: { $contains: 'report' } }","handlingStrategy":"type-guard","validationCode":"const SUPPORTED_OPERATORS = new Set([\n  '$eq', '$ne', '$gt', '$gte', '$lt', '$lte',\n  '$in', '$nin', '$contains', '$not_contains', '$regex', '$not_regex',\n]);\nfunction assertSupportedOperators(where: Record<string, unknown>): void {\n  for (const [k, v] of Object.entries(where)) {\n    if (k === '$and' || k === '$or') {\n      (v as unknown[]).forEach((c) => assertSupportedOperators(c as Record<string, unknown>));\n      continue;\n    }\n    if (v && typeof v === 'object' && !Array.isArray(v)) {\n      for (const op of Object.keys(v)) {\n        if (!SUPPORTED_OPERATORS.has(op)) {\n          throw new Error(`Unsupported operator ${op} on field ${k}`);\n        }\n      }\n    }\n  }\n}","typeGuard":"function isSupportedOperator(op: string): boolean {\n  return [\n    '$eq', '$ne', '$gt', '$gte', '$lt', '$lte',\n    '$in', '$nin', '$contains', '$not_contains', '$regex', '$not_regex',\n  ].includes(op);\n}","tryCatchPattern":"try {\n  await collection.query({ where });\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Unsupported where operator')) {\n    // rewrite the clause ($between -> $and range, $like -> $contains) and retry\n  } else {\n    throw e;\n  }\n}","preventionTips":["Centralize the operator list in one constant mirrored from comparisonOperatorMap and reuse it everywhere.","Unit-test every operator your app emits through the where parser.","When upgrading the chromadb client, diff the supported operator list before adopting new syntax."],"tags":["where-filter","unsupported-operator","query-validation","chroma"],"backgroundTag":"unsupported-filter-operator","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}