hasura/graphql-engine · error · AggregateBooleanExpressionError

the operand type '{operand_type}' does not match the type of

Error message

the operand type '{operand_type}' does not match the type of the model '{model_name}': '{model_type}'

What it means

The filter input model referenced by the aggregate boolean expression exists, but the model's underlying type does not match the operand type required by the boolean expression. The filter input model must be typed on the same object type as the operand it filters.

Source

Thrown at v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs:358

    ComparableRelationshipBooleanExpressionIncorrectOperandType {
        relationship_name: open_dds::relationships::RelationshipName,
        boolean_expression_type: Qualified<CustomTypeName>,
    },

    #[error(
        "the object type of the target of the relationship '{relationship_name}' ({relationship_target_object_type}) does not match the operand type of the boolean expression type '{boolean_expression_type}': '{boolean_expression_operand_type}'"
    )]
    ComparableRelationshipBooleanExpressionTypeMismatch {
        relationship_name: open_dds::relationships::RelationshipName,
        relationship_target_object_type: Qualified<CustomTypeName>,
        boolean_expression_type: Qualified<CustomTypeName>,
        boolean_expression_operand_type: Qualified<CustomTypeName>,
    },

    #[error("the filter input model '{model_name}' cannot be found")]
    FilterInputModelNotFound { model_name: Qualified<ModelName> },

    #[error(
        "the operand type '{operand_type}' does not match the type of the model '{model_name}': '{model_type}'"
    )]
    FilterInputModelTypeMismatch {
        operand_type: Qualified<CustomTypeName>,
        model_name: Qualified<ModelName>,
        model_type: Qualified<CustomTypeName>,
    },

    #[error(
        "a GraphQL field name conflict exists between the '{name}' {name_source_1} and the '{name}' {name_source_2}. One of these will need to be renamed."
    )]
    GraphqlNameConflict {
        name: String,
        name_source_1: NameSource,
        name_source_2: NameSource,
    },
}

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Point filter_input at a model whose type equals the operand type shown in the error.
  2. Or create a new filter input model on the correct object type and reference it.
  3. If the model type is genuinely wrong, update the model's underlying type to the operand type.

Example fix

# before
# operand type: Article
filter_input:
  model_name: UserFilter  # model_type: User
# after
# operand type: Article
filter_input:
  model_name: ArticleFilter  # model_type: Article
Defensive patterns

Strategy: validation

Validate before calling

for be in &metadata.boolean_expression_types {
    if let Some(fi) = &be.filter_input {
        let model = &models_by_name[&fi.model_name];
        assert_eq!(model.underlying_type, be.operand_type,
            "filter model {} is typed {} but operand is {}",
            fi.model_name, model.underlying_type, be.operand_type);
    }
}

Prevention

When it happens

Trigger: A filter input model whose model_type is object type A while the boolean expression operand type is B, e.g. reusing a UserFilter model for an Article operand.

Common situations: Sharing one filter model across types; changing a model's underlying type after wiring it into boolean expressions; refactoring operand types without updating filter input models.

Related errors


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