hasura/graphql-engine · error · TypePredicateError

no boolean expression found for type '{type_name:}' This is

Error message

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.

What it means

Filtering on a nested field requires the filtered model to have a `filterExpressionType` (boolean expression type) defined, but none was found for the type in question. Without a boolean expression type the resolver has no input shape for filters on that type, so nested-field filtering cannot proceed.

Source

Thrown at v3/crates/metadata-resolve/src/types/error.rs:475

    #[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}'"
    )]
    UnknownRelationshipInTypePredicate {
        relationship_name: Spanned<RelationshipName>,
        type_name: Qualified<CustomTypeName>,
    },
    #[error(
        "relationship '{relationship_name}' is used in predicate but does not exist in comparableRelationships in boolean expression '{boolean_expression_type_name}'"
    )]
    RelationshipNotComparableInTypePredicate {
        relationship_name: Spanned<RelationshipName>,

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Add `filterExpressionType` to the model named by `type_name` pointing at a valid boolean expression type
  2. Ensure that boolean expression type includes the nested field you are filtering on
  3. If you don't need filtering, remove the filter from the request/query rather than adding metadata

Example fix

# before
models:
  users: {source: {...}}   # no filterExpressionType
# after
models:
  users:
    source: {...}
    filterExpressionType: UserBooleanExpression
Defensive patterns

Strategy: validation

Validate before calling

// Before allowing nested-field filters, confirm the model has a filterExpressionType
if model.filter_expression_type.is_none() {
    return Err("model lacks filterExpressionType; nested filtering unsupported".into());
}

Type guard

fn supports_nested_filter(m: &Model) -> bool {
    m.filter_expression_type.is_some()
}

Try / catch

if let Err(TypePredicateError::NoBooleanExpressionFields { type_name, .. }) = result {
    // add filterExpressionType to the model or drop the nested filter
}

Prevention

When it happens

Trigger: Applying a filter that descends into a nested/relationship field of a model whose metadata lacks `filterExpressionType`; using custom metadata where you omitted filter types to slim the schema.

Common situations: Deliberately omitting boolean expression types to reduce schema size, then adding filters later; new models created by copying a minimal template without filter types; nested filtering enabled after initial metadata was authored.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/3e50573a1cbf928f. Report an issue: GitHub.