hasura/graphql-engine · error · AggregateBooleanExpressionError
the aggregate function '{aggregation_function_name}' is defi
Error message
the aggregate function '{aggregation_function_name}' is defined more than once in the comparable aggregation functions What it means
AggregateBooleanExpressionError::DuplicateAggregationFunctionFound: while collecting the comparable aggregation functions for an aggregate boolean expression, the same aggregation function name (e.g. max, count) appears more than once. Aggregation function names must be unique within that set.
Source
Thrown at v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs:161
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}'"
)]
AggregationFunctionNotFound {
aggregation_function_name: AggregationFunctionName,
aggregate_expression: Qualified<AggregateExpressionName>,
},
#[error(
"could not find a scalar-operanded boolean expression type named '{boolean_expression_type}'"
)]
ScalarBooleanExpressionTypeNotFound {View on GitHub (pinned to 724551b9ae)
Solutions
- Find the duplicated aggregation_function_name in the comparable list and remove or rename one entry
- If two variants with different operand types were intended, verify whether the function naming scheme needs suffixes per the OpenDD spec
- Re-run resolution to confirm uniqueness
Example fix
# before
comparable_aggregation_functions:
- name: max
operand: app.Int64
- name: max
operand: app.Float64
# after
comparable_aggregation_functions:
- name: max
operand: app.Int64
- name: max_float # or single generic entry
operand: app.Float64 Defensive patterns
Strategy: validation
Validate before calling
use std::collections::HashSet;
fn function_names_unique(fns: &[AggregationFunctionDef]) -> bool {
fns.iter().map(|f| f.name.clone()).collect::<HashSet<_>>().len() == fns.len()
} Try / catch
if let AggregateBooleanExpressionError::DuplicateAggregationFunctionFound { aggregation_function_name } = err {
eprintln!("remove the duplicate '{aggregation_function_name}' entry");
} Prevention
- Deduplicate aggregation function lists before submitting
- Review merged metadata for duplicated entries
- Write a lint that flags repeated names in comparable functions
When it happens
Trigger: Listing the same aggregation function twice in the comparable aggregation functions of an aggregate boolean expression, e.g. two entries both named max with different operand types.
Common situations: Copy-pasted YAML entries when adding a new aggregation function, merging metadata that introduces duplicates, refactors that changed operand types instead of adding distinct function entries.
Related errors
- the aggregation function '{aggregation_function_name}' is no
- error in getting server feature flags %w
- Cannot add query root field {0} as it already in use
- Cannot add mutation root field {0} as it already in use
- Cannot add subscription root field {0} as it already in use
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/ee879ed0f46efbe8.
Report an issue: GitHub.