{"record":{"id":"fa33917686d11a00","repo":"cube-js/cube","slug":"operator-required-for-filter-json-stringify-f","errorCode":null,"errorMessage":"Operator required for filter: ${JSON.stringify(f)}","messagePattern":"Operator required for filter: (.+?)","errorType":"validation","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"packages/cubejs-api-gateway/src/query.js","lineNumber":369,"sourceCode":"  }\n\n  return filter;\n};\n\nconst normalizeQueryFilters = (filter, timezone) => (\n  filter.map(f => {\n    const res = { ...f };\n    if (f.or) {\n      res.or = normalizeQueryFilters(f.or, timezone);\n      return res;\n    }\n    if (f.and) {\n      res.and = normalizeQueryFilters(f.and, timezone);\n      return res;\n    }\n\n    if (!f.operator) {\n      throw new UserError(`Operator required for filter: ${JSON.stringify(f)}`);\n    }\n\n    if (operators.indexOf(f.operator) === -1) {\n      throw new UserError(`Operator ${f.operator} not supported for filter: ${JSON.stringify(f)}`);\n    }\n\n    if ((!f.values || f.values.length === 0) && ['set', 'notSet', 'measureFilter'].indexOf(f.operator) === -1) {\n      throw new UserError(`Values required for filter: ${JSON.stringify(f)}`);\n    }\n\n    if (f.values) {\n      res.values = f.values.map(v => (v != null ? v.toString() : v));\n    }\n\n    if (f.dimension) {\n      res.member = f.dimension;\n      delete res.dimension;\n    }","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-api-gateway/src/query.js#L351-L387","documentation":"Validation guard in normalizeQueryFilters: a filter object in the query's filter array lacks the required `operator` property. It fires for any leaf filter (not part of or/and groups) submitted without an operator, before operator whitelist checking.","triggerScenarios":"Thrown at packages/cubejs-api-gateway/src/query.js:369 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a valid operator field (e.g. \"equals\", \"contains\", \"inDateRange\") to the filter object.","Check that the filter was not corrupted by client-side serialization dropping the operator key.","If the filter is meant to be optional, remove it from the query entirely."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}