{"record":{"id":"853746437f5a96b2","repo":"cube-js/cube","slug":"filter-group-expects-filter-params-args-to-be-pass-853746","errorCode":null,"errorMessage":"FILTER_GROUP expects FILTER_PARAMS args to be passed.","messagePattern":"FILTER_GROUP expects FILTER_PARAMS args to be passed\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-schema-compiler/src/adapter/MemberSqlTemplateCompiler.js","lineNumber":236,"sourceCode":"}\n\nfunction filterParamsProxy(state) {\n  return new Proxy({}, {\n    get(_t, cubeName) {\n      return new Proxy({}, {\n        get(_t2, memberName) {\n          return filterParamsItemProxy(cubeName, memberName, state);\n        },\n      });\n    },\n  });\n}\n\nfunction filterGroupFn(state) {\n  return (...args) => {\n    const filterParams = args.map(arg => {\n      if (!arg || typeof arg.__member === 'undefined') {\n        throw new Error('FILTER_GROUP expects FILTER_PARAMS args to be passed.');\n      }\n      return arg.__member;\n    });\n    const index = state.target.filterGroups.length;\n    state.target.filterGroups.push({ filterParams });\n    return placeholder(FILTER_GROUP_PREFIX, index);\n  };\n}\n\n// ---- SECURITY_CONTEXT ------------------------------------------------------\n\nfunction coerceScalarToString(value) {\n  if (typeof value === 'string') return value;\n  if (typeof value === 'number') return `${value}`;\n  if (typeof value === 'boolean') return `${value}`;\n  throw new Error('Invalid param for security context');\n}\n","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-schema-compiler/src/adapter/MemberSqlTemplateCompiler.js#L218-L254","documentation":"The FILTER_GROUP template function expects each argument to be a FILTER_PARAMS-wrapped member object (having __member). Any null/undefined/plain-string argument causes this Error. It indicates FILTER_PARAMS.filter(...) was called without proper FILTER_PARAMS args inside a member SQL template.","triggerScenarios":"In a member sql template, calling FILTER_GROUP/FILTER_PARAMS with literal strings or missing arguments, e.g. `FILTER_PARAMS.foo.filter('1=1')` instead of passing a member expression, or interpolating the template with undefined values.","commonSituations":"Hand-writing template SQL and confusing FILTER_PARAMS.filter argument shape; nested template helpers generating empty args; upgrading and changing the internal template API usage.","solutions":["Ensure every argument to FILTER_PARAMS.filter is a member-based expression produced by the template context (e.g. FILTER_PARAMS.dimension.filter(`${CUBE}.x`)).","Check that the sql template string is built with all FILTER_PARAMS arguments present and not interpolated as raw strings.","Review recent template changes; FILTER_GROUP placeholders are generated internally, so avoid emitting them manually."],"exampleFix":"// before\nsql: `${FILTER_GROUP(FILTER_PARAMS.Events.status.filter('1=1'))}` // raw string arg\n// after\nsql: `${FILTER_PARAMS.Events.status.filter(`${CUBE}.status = 'open'`)}`","handlingStrategy":"type-guard","validationCode":"if (typeof arg !== 'object' || arg === null || !('__member' in arg)) {\n  throw new Error('FILTER_PARAMS args must be member expressions');\n}","typeGuard":"function isFilterParamMember(arg) {\n  return typeof arg === 'object' && arg !== null && '__member' in arg;\n}","tryCatchPattern":"try { compiled = compiler.compile(); } catch (e) { if (/FILTER_GROUP expects FILTER_PARAMS args/.test(e.message)) { console.error('Fix FILTER_PARAMS usage in member sql templates'); } else throw e; }","preventionTips":["Only pass member expressions to FILTER_PARAMS.filter","Never emit FILTER_GROUP placeholders manually","Add tests compiling every member template with FILTER_PARAMS"],"tags":["filter-params","sql-template","user-error"],"backgroundTag":"invalid-filter-params-usage","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}