remix-run/remix · error · Error

Unsupported predicate

Error message

Unsupported predicate

What it means

The Postgres SQL compiler's predicate walker handles comparison and logical (and/or/not) predicates; any predicate object with an unrecognized `type` falls through to this throw. It indicates a malformed predicate or version mismatch between core and Postgres adapter.

Source

Thrown at packages/data-table-postgres/src/lib/sql-compiler.ts:688

    return (
      quotePath(predicate.column) + (predicate.operator === 'isNull' ? ' is null' : ' is not null')
    )
  }

  if (predicate.type === 'logical') {
    if (predicate.predicates.length === 0) {
      return predicate.operator === 'and' ? '1 = 1' : '1 = 0'
    }

    let childOperator = predicate.operator === 'and' ? ' and ' : ' or '
    let childPredicates = predicate.predicates
      .map((child) => '(' + compilePredicate(child, context) + ')')
      .join(childOperator)

    return childPredicates
  }

  throw new Error('Unsupported predicate')
}

function compileComparisonValue(
  predicate: Extract<Predicate, { type: 'comparison' }>,
  context: CompileContext,
): string {
  if (predicate.valueType === 'column') {
    return quotePath(predicate.value)
  }

  return pushValue(context, predicate.value)
}

function normalizeJoinType(type: string): string {
  return normalizeJoinTypeHelper(type)
}

function quoteIdentifier(value: string): string {

View on GitHub (pinned to 9696913134)

Solutions

  1. Build predicates with the builder helpers (eq, and, or, not, ...)
  2. Align all data-table package versions
  3. Validate predicate.type against known kinds before passing to where/having

Example fix

// before
.where({ column: 'email', value: 'a@b.c' } as any) // no type → throws

// after
.where(eq('email', 'a@b.c'))
Defensive patterns

Strategy: validation

Validate before calling

const PREDICATE_TYPES = new Set(['comparison','and','or','not'])
if (!PREDICATE_TYPES.has((predicate as any).type)) { /* rebuild via builder */ }

Type guard

function isPredicate(p: unknown): p is Predicate { return !!p && typeof p === 'object' && ['comparison','and','or','not'].includes((p as { type?: string }).type ?? '') }

Prevention

When it happens

Trigger: Passing where/having/join predicates with missing or unknown `type` discriminants; a newer core package emitting predicate kinds the installed postgres compiler doesn't handle; predicates reconstructed from JSON that lost their type field.

Common situations: Hand-rolled predicate objects; partial upgrades across the monorepo; IPC/serialization round-trips stripping fields.

Related errors


AI-assisted analysis of remix-run/remix@9696913134 (2026-08-27). Data as JSON: /api/errors/fbe137a5ad5e8217. Report an issue: GitHub.