hasura/graphql-engine · error · AggregateBooleanExpressionError
the operand type '{operand_type}' does not match the operand
Error message
the operand type '{operand_type}' does not match the operand type '{aggregate_operand}' from the aggregate expression '{aggregate_expression}' What it means
AggregateBooleanExpressionError::AggregateOperandTypeMismatch: the operand type declared on the boolean expression does not match the operand type declared on the referenced aggregate expression. Both types and the aggregate expression name are shown so the discrepancy is easy to locate.
Source
Thrown at v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs:152
#[error("{0}")]
GraphqlConfigError(#[from] GraphqlConfigError),
#[error("the operand type '{operand_type}' must be a scalar type")]
OperandTypeIsNotAScalarType {
operand_type: Qualified<CustomTypeName>,
},
#[error("the operand type '{operand_type}' must be an object type")]
OperandTypeIsNotAnObjectType {
operand_type: Qualified<CustomTypeName>,
},
#[error("the aggregate expression '{aggregate_expression}' could not be found")]
AggregateExpressionNotFound {
aggregate_expression: Qualified<AggregateExpressionName>,
},
#[error(
"the operand type '{operand_type}' does not match the operand type '{aggregate_operand}' from the aggregate expression '{aggregate_expression}'"
)]
AggregateOperandTypeMismatch {
operand_type: QualifiedTypeName,
aggregate_expression: Qualified<AggregateExpressionName>,
aggregate_operand: QualifiedTypeName,
},
#[error(
"the aggregate function '{aggregation_function_name}' is defined more than once in the comparable aggregation functions"
)]
DuplicateAggregationFunctionFound {
aggregation_function_name: AggregationFunctionName,
},
#[error(
"the aggregation function '{aggregation_function_name}' is not defined in the aggregate expression '{aggregate_expression}'"
)]View on GitHub (pinned to 724551b9ae)
Solutions
- Align the boolean expression's operand type with the aggregate expression's operand type
- Alternatively, point the boolean expression at an aggregate expression that shares its operand type
- Re-run resolution after the change
Example fix
# before operand: app.Order # boolean expression aggregate_expression: stats.MaxUserScore # operand: app.User # after aggregate_expression: stats.MaxOrderTotal # operand: app.Order
Defensive patterns
Strategy: validation
Validate before calling
fn operands_match(
boolean_expr_operand: &QualifiedTypeName,
aggregate: &AggregateExpression,
) -> bool {
&aggregate.operand_type == boolean_expr_operand
} Try / catch
if let AggregateBooleanExpressionError::AggregateOperandTypeMismatch { operand_type, aggregate_operand, aggregate_expression } = err {
eprintln!("{operand_type:?} != {aggregate_operand:?} on {aggregate_expression:?}");
} Prevention
- Retype both sides together when changing operand types
- Add a consistency check comparing operand types across references
- Prefer referencing aggregate expressions defined for the same domain/type
When it happens
Trigger: An aggregate boolean expression declares operand_type T1 but references an aggregate expression whose operand is T2 (T1 != T2), e.g. after retyping one side but not the other.
Common situations: Renaming or retyping the operand on the aggregate expression without updating dependent boolean expressions, copy-pasting boolean expressions across domains.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- the aggregate expression '{aggregate_expression}' could not
- the aggregate function '{aggregation_function_name}' is defi
- the aggregation function '{aggregation_function_name}' is no
- type mismatch between the aggregation function '{aggregation
- the aggregation function '{aggregation_function_name}' retur
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/8c7ccf7128bb8f14.
Report an issue: GitHub.