{"record":{"id":"ee879ed0f46efbe8","repo":"hasura/graphql-engine","slug":"the-aggregate-function-aggregation-function-name","errorCode":null,"errorMessage":"the aggregate function '{aggregation_function_name}' is defined more than once in the comparable aggregation functions","messagePattern":"the aggregate function '(.+?)' is defined more than once in the comparable aggregation functions","errorType":"validation","errorClass":"AggregateBooleanExpressionError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs","lineNumber":161,"sourceCode":"    OperandTypeIsNotAnObjectType {\n        operand_type: Qualified<CustomTypeName>,\n    },\n\n    #[error(\"the aggregate expression '{aggregate_expression}' could not be found\")]\n    AggregateExpressionNotFound {\n        aggregate_expression: Qualified<AggregateExpressionName>,\n    },\n\n    #[error(\n        \"the operand type '{operand_type}' does not match the operand type '{aggregate_operand}' from the aggregate expression '{aggregate_expression}'\"\n    )]\n    AggregateOperandTypeMismatch {\n        operand_type: QualifiedTypeName,\n        aggregate_expression: Qualified<AggregateExpressionName>,\n        aggregate_operand: QualifiedTypeName,\n    },\n\n    #[error(\n        \"the aggregate function '{aggregation_function_name}' is defined more than once in the comparable aggregation functions\"\n    )]\n    DuplicateAggregationFunctionFound {\n        aggregation_function_name: AggregationFunctionName,\n    },\n\n    #[error(\n        \"the aggregation function '{aggregation_function_name}' is not defined in the aggregate expression '{aggregate_expression}'\"\n    )]\n    AggregationFunctionNotFound {\n        aggregation_function_name: AggregationFunctionName,\n        aggregate_expression: Qualified<AggregateExpressionName>,\n    },\n\n    #[error(\n        \"could not find a scalar-operanded boolean expression type named '{boolean_expression_type}'\"\n    )]\n    ScalarBooleanExpressionTypeNotFound {","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs#L143-L179","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\ncomparable_aggregation_functions:\n  - name: max\n    operand: app.Int64\n  - name: max\n    operand: app.Float64\n\n# after\ncomparable_aggregation_functions:\n  - name: max\n    operand: app.Int64\n  - name: max_float   # or single generic entry\n    operand: app.Float64","handlingStrategy":"validation","validationCode":"use std::collections::HashSet;\nfn function_names_unique(fns: &[AggregationFunctionDef]) -> bool {\n    fns.iter().map(|f| f.name.clone()).collect::<HashSet<_>>().len() == fns.len()\n}","typeGuard":null,"tryCatchPattern":"if let AggregateBooleanExpressionError::DuplicateAggregationFunctionFound { aggregation_function_name } = err {\n    eprintln!(\"remove the duplicate '{aggregation_function_name}' entry\");\n}","preventionTips":["Deduplicate aggregation function lists before submitting","Review merged metadata for duplicated entries","Write a lint that flags repeated names in comparable functions"],"tags":["metadata","aggregate-expression","duplicate","aggregation"],"backgroundTag":"duplicate-definition-in-config","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}