remix-run/remix · error · Error

Unsupported predicate

Error message

Unsupported predicate

What it means

compilePredicate compiles where/having/on predicates and only understands specific predicate types (comparison, logical and/or/not, etc.). Any object with an unrecognized type reaches the final throw. It's the compiler's guard against malformed or unsupported predicate trees.

Source

Thrown at packages/data-table-sqlite/src/lib/sql-compiler.ts:447

  if (predicate.type === 'null') {
    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 joiner = predicate.operator === 'and' ? ' and ' : ' or '

    return predicate.predicates
      .map((child) => '(' + compilePredicate(child, context) + ')')
      .join(joiner)
  }

  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 exclusively with the exported helpers (eq, ne, gt, and, or, not, ...) instead of raw object literals.
  2. Align data-table and data-table-sqlite versions to the same release.
  3. Log/inspect the predicate tree to identify which node has the unsupported type.

Example fix

// before
where: { type: 'cmp', column: 'id', op: '=', value: 1 }

// after
where: eq(table.id, 1)
Defensive patterns

Strategy: type-guard

Validate before calling

const KNOWN_PREDICATES = new Set(['comparison','and','or','not','in','between','null'])
function assertPredicates(node: any) {
  if (!KNOWN_PREDICATES.has(node?.type)) throw new Error(`Bad predicate: ${node?.type}`)
  node.predicates?.forEach(assertPredicates)
}

Type guard

function isPredicate(node: unknown): node is { type: string } {
  return typeof node === 'object' && node !== null && typeof (node as any).type === 'string'
}

Prevention

When it happens

Trigger: Passing a hand-built predicate with a misspelled or unknown type into where()/having()/on(); a version mismatch where the core emits a new predicate type the SQLite compiler doesn't know; nesting predicates built by different package versions.

Common situations: Version skew between data-table core and data-table-sqlite; constructing where clauses as raw objects instead of using the query builder helpers (eq, and, or, not).

Related errors


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