hasura/graphql-engine · error · TypePredicateError

field '{field_name:}' could not be found in boolean expressi

Error message

field '{field_name:}' could not be found in boolean expression type for object type '{type_name:}'

What it means

A predicate references a field that is not part of the boolean expression type generated/declared for the given object type. This is the filtering-path variant of 'field not found': the field may exist on the object type, but the filter input type for that object does not expose it.

Source

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

        "field '{field_name:}' of type '{type_name:}' is an array type and cannot be used in a nested field predicate"
    )]
    ArrayFieldInNestedFieldPredicate {
        field_name: Spanned<FieldName>,
        type_name: Qualified<CustomTypeName>,
    },
    #[error(
        "unknown field '{field_name}' for type '{type_name}' used in target mapping for relationship '{relationship_name}'"
    )]
    UnknownFieldInModelRelationshipTargetMapping {
        field_name: FieldName,
        type_name: Qualified<CustomTypeName>,
        relationship_name: RelationshipName,
    },
    #[error("boolean expression '{boolean_expression_name:}' not found")]
    BooleanExpressionNotFound {
        boolean_expression_name: Qualified<CustomTypeName>,
    },
    #[error(
        "field '{field_name:}' could not be found in boolean expression type for object type '{type_name:}'"
    )]
    BooleanExpressionFieldNotFound {
        field_name: Spanned<FieldName>,
        type_name: Qualified<CustomTypeName>,
    },
    #[error(
        "the source data connector {data_connector:} for type {type_name:} has not been defined"
    )]
    UnknownTypeDataConnector {
        type_name: Qualified<CustomTypeName>,
        data_connector: Qualified<DataConnectorName>,
    },
    #[error(
        "field '{field_name}' of type '{type_name}' used in a field comparison has the unknown NDC type '{ndc_type_name}' and therefore cannot be compared to a single value"
    )]
    UnsupportedFieldComparisonToUnknownType {
        field_name: Spanned<FieldName>,

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Compare the filter input fields for `type_name` with the `field_name` you used
  2. Add the field to the boolean expression type (or remove the filterExpressionType override so the default generated one includes it)
  3. Filter on a field that the boolean expression type actually exposes

Example fix

# before
types:
  UserBoolExpr:
    fields: {id: ..., name: ...}
# filter on 'email' fails
# after: add email to the expression type (or drop the custom type)
types:
  UserBoolExpr:
    fields: {id: ..., name: ..., email: ...}
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the field exists in the type's boolean expression before filtering
if !bool_expr_type.data_fields.contains_key(&field_name) {
    return Err("field not in boolean expression type".into());
}

Type guard

fn in_bool_expr(e: &BooleanExpressionType, f: &FieldName) -> bool {
    e.data_fields.contains_key(f)
}

Try / catch

if let Err(TypePredicateError::BooleanExpressionFieldNotFound { field_name, type_name }) = result {
    // add field to the expression type or choose another field
}

Prevention

When it happens

Trigger: Filtering on a field omitted from the object's boolean expression type; using a hand-written filterExpressionType that skips fields; filtering on fields added after the boolean expression type was authored.

Common situations: Custom boolean expression types drifting out of sync with the model; newly added model fields not added to the filter type; filtering on fields marked non-filterable.

Related errors


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