refinedev/refine · warning

@packages/hasura: multiple filters present. Group multiple p

Error message

@packages/hasura: multiple filters present. Group multiple parameters using the _and or the _or operator. Tip: You can use the _or and _and operators along with the _not operator to create arbitrarily complex boolean expressions involving multiple filtering criteria.

What it means

Console warning from @refinedev/hasura's `generateFilters`/`mergeHasuraFilters` util. Hasura GraphQL queries cannot express multiple top-level filters; they must be combined with `_and`/`_or` operators. When the incoming filter set yields more than one arbitrary operator filter, or a combination of _and/_or with additional arbitrary filters, the merger warns that the resulting query may be incorrect or dropped.

Source

Thrown at packages/hasura/src/utils/generateFilters.ts:210

  const arbitraryOperators = gqlVariableFilters.filter((f) => {
    const [k] = f;
    return !isMultiConditionFilter(k);
  });

  if (
    arbitraryOperators.length > 1 ||
    (metaFilters._and && arbitraryOperators.length)
  ) {
    if (!mergedFilters._and) {
      mergedFilters._and = [];
    }
  }

  if (
    arbitraryOperators.length > 1 ||
    ((metaFilters._and || metaFilters._or) && arbitraryOperators.length)
  ) {
    console.warn(
      "@packages/hasura: multiple filters present. Group multiple parameters using the _and or the _or operator. Tip: You can use the _or and _and operators along with the _not operator to create arbitrarily complex boolean expressions involving multiple filtering criteria.",
    );
  }

  gqlVariableFilters.forEach((filter) => {
    const [k, v] = filter;

    if (!isMultiConditionFilter(k) && mergedFilters._and) {
      // Group Multiple Parameters Together
      mergedFilters._and = mergedFilters._and.concat({ [k]: v });
    } else if (k === "_and" && mergedFilters._and) {
      // Merge _and conditions from both groups of Hasura Filters
      if (!Array.isArray(v)) {
        throw new Error(
          "@packages/hasura: unexpected value for BoolExp _and. Expected an Array.",
        );
      }
      mergedFilters._and = mergedFilters._and.concat(v);

View on GitHub (pinned to 779d52a20e)

Solutions

  1. Wrap multiple conditions in an `_and` (or `_or`) operator inside your filters: `[{ field: 'x', operator: 'eq', value: 1 }, ...]` → pass `{ operator: 'and', value: [...] }`
  2. Set `meta.filters` / permanentFilter as a single grouped logical filter instead of a flat array of operator filters
  3. Review @refinedev/hasura docs for nested logical filter structure and adjust your resource definition

Example fix

// before
permanentFilter: [
  { field: 'storeId', operator: 'eq', value: 1 },
  { field: 'status', operator: 'eq', value: 'active' },
]
// after
permanentFilter: {
  operator: 'and',
  value: [
    { field: 'storeId', operator: 'eq', value: 1 },
    { field: 'status', operator: 'eq', value: 'active' },
  ],
}
Defensive patterns

Strategy: validation

Validate before calling

const looseFilters = filters.filter((f) => !['and','or'].includes(f.operator));
if (looseFilters.length > 1) {
  console.warn('Hasura: wrap multiple filters in an _and/_or group');
}

Type guard

const isGrouped = (filters: any[]) =>
  filters.every((f) => f.operator === 'and' || f.operator === 'or' || filters.length === 1);

Prevention

When it happens

Trigger: Calling a data hook (useTable/useList with filters) against the Hasura data provider with `permanentFilter`/`filters` containing multiple operator filters (e.g. two `eq` filters on different fields) that are not nested under `_and`/`_or`, or mixing `_and`/`_or` blocks with loose operator filters.

Common situations: Defining multiple permanentFilter entries at the top level; combining user-applied table filters with pre-set permanent filters; migrating from a provider that auto-ANDs filters.

Related errors


AI-assisted analysis of refinedev/refine@779d52a20e (2026-08-27). Data as JSON: /api/errors/8f63ff5331c93dc2. Report an issue: GitHub.