hasura/graphql-engine · error · TypePredicateError
Invalid operator used in type '{type_name:}' predicate: '{op
Error message
Invalid operator used in type '{type_name:}' predicate: '{operator_name:}' What it means
A type predicate used an operator name that is not valid for that type's boolean expression. Each boolean expression type exposes a fixed operator vocabulary; referencing any other operator string fails resolution with the type and offending operator name.
Source
Thrown at v3/crates/metadata-resolve/src/types/error.rs:466
#[error(
"field '{field_name}' of type '{type_name}' used in a field comparison is an array type and therefore cannot be compared to a single value"
)]
UnsupportedFieldComparisonToArrayType {
field_name: Spanned<FieldName>,
field_type: QualifiedTypeReference,
type_name: Qualified<CustomTypeName>,
},
#[error(
"field '{field_name}' of type '{type_name}' used in a field comparison is a predicate type and therefore cannot be compared to a single value"
)]
UnsupportedFieldComparisonToPredicateType {
field_name: Spanned<FieldName>,
field_type: QualifiedTypeReference,
type_name: Qualified<CustomTypeName>,
},
#[error("Invalid operator used in type '{type_name:}' predicate: '{operator_name:}'")]
InvalidOperatorInTypePredicate {
type_name: Qualified<CustomTypeName>,
operator_name: Spanned<OperatorName>,
},
#[error("Nested predicate used in type '{type_name:}'")]
NestedPredicateInTypePredicate {
type_name: Qualified<CustomTypeName>,
},
#[error(
"no boolean expression found for type '{type_name:}' This is required when filtering a nested field. Please ensure the model you are filtering has a filterExpressionType defined."
)]
NoBooleanExpressionFields {
field_name: Spanned<FieldName>,
type_name: Qualified<CustomTypeName>,
},
#[error(
"relationship '{relationship_name}' is used in predicate but does not exist for type '{type_name}'"
)]View on GitHub (pinned to 724551b9ae)
Solutions
- Check `operator_name` for typos (e.g. `_eque` -> `_eq`)
- Look up the operators the type's boolean expression actually supports and use one of those
- Enable/map the operator in the connector's metadata or boolean expression definition if it should be supported
- Test filters per-connector rather than assuming a universal operator set
Example fix
// before
{"field": "name", "operator": "_equals", "value": "bob"}
// after
{"field": "name", "operator": "_eq", "value": "bob"}
Defensive patterns
Strategy: validation
Validate before calling
// Validate operators against the type's declared predicate operators
if !type_predicate.operators.contains_key(&operator_name) {
return Err(format!("operator {operator_name} not valid for type"));
} Type guard
fn operator_valid(tp: &TypePredicate, op: &OperatorName) -> bool {
tp.operators.contains_key(op)
} Try / catch
if let Err(TypePredicateError::InvalidOperatorInTypePredicate { type_name, operator_name }) = result {
return Err(format!("{operator_name} unsupported on {type_name}; check available operators"));
} Prevention
- Derive operator choice from the connector/expression schema, not hardcoding
- Add filter unit tests per connector type
When it happens
Trigger: Using an operator like `_regex`, `_ilike`, or a custom name not defined in the type's predicate operators; typos in operator names; assuming Postgres-style operators exist on non-Postgres connectors.
Common situations: Switching connectors (e.g. Postgres to DynamoDB) while keeping the same filters; connector not supporting a given operator on a type; custom boolean expressions with a restricted operator set.
Related errors
- unknown field '{field_name:}' used in predicate for type '{t
- field '{field_name:}' used in predicate for type '{type_name
- field '{field_name}' of type '{type_name}' used in a field c
- Nested predicate used in type '{type_name:}'
- relationship '{relationship_name}' is used in predicate but
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/67b3dbd89f75896c.
Report an issue: GitHub.