refinedev/refine · error · Error

Operator 'and' is not supported

Error message

Operator 'and' is not supported

What it means

The Supabase filter generator historically did not support the "and" combinator, so any filter whose operator is "and" (a logical filter joining sub-filters) throws. Supabase/PostgREST expresses AND implicitly by stacking filters, so explicit 'and' filters were unsupported in this code path.

Source

Thrown at packages/supabase/src/utils/generateFilter.ts:86

            }

            if (item.operator === "endswith") {
              value = `%${value}`;
            }
            if (item.operator === "in") {
              value = `(${item.value.map((val: any) => `"${val}"`).join(",")})`;
            }

            return `${item.field}.${mapOperator(item.operator)}.${value}`;
          }
          return;
        })
        .join(",");
      return query.or(orSyntax);
    }

    case "and":
      throw Error("Operator 'and' is not supported");
    default:
      return query.filter(
        filter.field,
        mapOperator(filter.operator),
        filter.value,
      );
  }
};

View on GitHub (pinned to 779d52a20e)

Solutions

  1. Upgrade @refinedev/supabase (and refine core) to a version supporting logical 'and'/'or' filters
  2. Replace the 'and' wrapper with flat filters — multiple filters on Supabase are ANDed by default
  3. For complex AND/OR groups, build the filter with supabaseClient .or()/.and() manually via custom query logic

Example fix

// before
filters: [{ operator: "and", value: [{ field: "status", operator: "eq", value: "active" }, { field: "price", operator: "lt", value: 100 }] }]

// after
filters: [
  { field: "status", operator: "eq", value: "active" },
  { field: "price", operator: "lt", value: 100 },
]
Defensive patterns

Strategy: validation

Validate before calling

const hasAnd = (filters: any[]): boolean =>
  filters.some((f) => f.operator === "and" || (Array.isArray(f.value) && f.value?.some?.((v: any) => v.operator === "and")));

Type guard

const isSupportedFilter = (f: { operator: string }): boolean => f.operator !== "and";

Try / catch

try { await dataProvider.getList({ resource, filters }); } catch (e) { if (String(e).includes("'and' is not supported")) { /* flatten logical and-filters into plain filters and retry */ } else throw e; }

Prevention

When it happens

Trigger: Passing a logical filter { operator: "and", value: [filterA, filterB] } into useTable/useList filters with the Supabase provider, e.g. via permanentFilter or combined search filters.

Common situations: Combining multiple filters with logical operators copied from Strapi examples; using refine versions before Supabase and/or/nested logical filter support landed; upgrading refine and having legacy filter structures hit new code paths.

Related errors


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