cube-js/cube · error · Error

FILTER_GROUP expects FILTER_PARAMS args to be passed.

Error message

FILTER_GROUP expects FILTER_PARAMS args to be passed.

What it means

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.

Source

Thrown at packages/cubejs-schema-compiler/src/adapter/MemberSqlTemplateCompiler.js:236

}

function filterParamsProxy(state) {
  return new Proxy({}, {
    get(_t, cubeName) {
      return new Proxy({}, {
        get(_t2, memberName) {
          return filterParamsItemProxy(cubeName, memberName, state);
        },
      });
    },
  });
}

function filterGroupFn(state) {
  return (...args) => {
    const filterParams = args.map(arg => {
      if (!arg || typeof arg.__member === 'undefined') {
        throw new Error('FILTER_GROUP expects FILTER_PARAMS args to be passed.');
      }
      return arg.__member;
    });
    const index = state.target.filterGroups.length;
    state.target.filterGroups.push({ filterParams });
    return placeholder(FILTER_GROUP_PREFIX, index);
  };
}

// ---- SECURITY_CONTEXT ------------------------------------------------------

function coerceScalarToString(value) {
  if (typeof value === 'string') return value;
  if (typeof value === 'number') return `${value}`;
  if (typeof value === 'boolean') return `${value}`;
  throw new Error('Invalid param for security context');
}

View on GitHub (pinned to 7d981676b3)

Solutions

  1. 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`)).
  2. Check that the sql template string is built with all FILTER_PARAMS arguments present and not interpolated as raw strings.
  3. Review recent template changes; FILTER_GROUP placeholders are generated internally, so avoid emitting them manually.

Example fix

// before
sql: `${FILTER_GROUP(FILTER_PARAMS.Events.status.filter('1=1'))}` // raw string arg
// after
sql: `${FILTER_PARAMS.Events.status.filter(`${CUBE}.status = 'open'`)}`
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof arg !== 'object' || arg === null || !('__member' in arg)) {
  throw new Error('FILTER_PARAMS args must be member expressions');
}

Type guard

function isFilterParamMember(arg) {
  return typeof arg === 'object' && arg !== null && '__member' in arg;
}

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/853746437f5a96b2. Report an issue: GitHub.