hasura/graphql-engine · error · AggregateBooleanExpressionError
the aggregation function '{aggregation_function_name}' is no
Error message
the aggregation function '{aggregation_function_name}' is not defined in the aggregate expression '{aggregate_expression}' What it means
AggregateBooleanExpressionError::AggregationFunctionNotFound: the boolean expression declares an aggregation function (e.g. avg) that is not among the aggregation functions defined by the referenced aggregate expression. Both the function name and the aggregate expression name are reported.
Source
Thrown at v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs:168
},
#[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}'"
)]
AggregationFunctionNotFound {
aggregation_function_name: AggregationFunctionName,
aggregate_expression: Qualified<AggregateExpressionName>,
},
#[error(
"could not find a scalar-operanded boolean expression type named '{boolean_expression_type}'"
)]
ScalarBooleanExpressionTypeNotFound {
boolean_expression_type: BooleanExpressionTypeIdentifier,
},
#[error(
"type mismatch between the aggregation function '{aggregation_function_name}' (return type: '{aggregation_function_return_type}') and the specified boolean expression type '{boolean_expression_type}' (operand type: '{boolean_expression_operand_type}')"
)]
AggregationFunctionTypeMismatch {View on GitHub (pinned to 724551b9ae)
Solutions
- Add the missing aggregation function to the aggregate expression's definition
- Or remove/rename the aggregation function reference in the boolean expression
- Check for typos (avg vs average) against the aggregate expression's declared function names
Example fix
# before aggregate_expression: stats.Scores # defines max, min comparable: functions: [max, avg] # avg not defined # after comparable: functions: [max, min]
Defensive patterns
Strategy: validation
Validate before calling
fn function_defined(aggregate: &AggregateExpression, f: &str) -> bool {
aggregate.functions.iter().any(|d| d.name.as_str() == f)
} Try / catch
if let AggregateBooleanExpressionError::AggregationFunctionNotFound { aggregation_function_name, aggregate_expression } = err {
eprintln!("'{aggregation_function_name}' is not defined by {aggregate_expression:?}");
} Prevention
- Only list aggregation functions the aggregate expression actually defines
- Update boolean expressions when removing functions from an aggregate expression
- Watch for function-name typos (avg vs average)
When it happens
Trigger: Listing a comparable aggregation function on a boolean expression that the target aggregate expression does not define, e.g. requiring avg when the aggregate expression only defines max/min/count.
Common situations: Assuming standard SQL aggregate functions exist on a custom aggregate expression, updating an aggregate expression to drop a function while boolean expressions still reference it, typos in function names.
Related errors
- the aggregate expression '{aggregate_expression}' could not
- the aggregate function '{aggregation_function_name}' is defi
- the operand type '{operand_type}' does not match the operand
- the type of the comparable field '{field_name}' ({field_type
- the boolean expression type ({boolean_expression_type}) used
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/1808125b11637993.
Report an issue: GitHub.