{"record":{"id":"218e45cf33fbfd12","repo":"hasura/graphql-engine","slug":"the-aggregate-expression-aggregate-expression","errorCode":null,"errorMessage":"the aggregate expression '{aggregate_expression}' could not be found","messagePattern":"the aggregate expression '(.+?)' could not be found","errorType":"validation","errorClass":"AggregateBooleanExpressionError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs","lineNumber":147,"sourceCode":"    AggregateBooleanExpressionsNotSupported,\n\n    #[error(\"boolean expressions with aggregate operands do not support isNull comparisons\")]\n    IsNullComparisonsNotSupported,\n\n    #[error(\"{0}\")]\n    GraphqlConfigError(#[from] GraphqlConfigError),\n\n    #[error(\"the operand type '{operand_type}' must be a scalar type\")]\n    OperandTypeIsNotAScalarType {\n        operand_type: Qualified<CustomTypeName>,\n    },\n\n    #[error(\"the operand type '{operand_type}' must be an object type\")]\n    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,","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs#L129-L165","documentation":"AggregateBooleanExpressionError::AggregateExpressionNotFound: the aggregate boolean expression references a qualified aggregate expression name that cannot be found in the resolved metadata. The missing qualified name is included in the message.","triggerScenarios":"Using an aggregate_expression reference (subgraph + AggregateExpressionName) that was never defined, is defined in another subgraph, or is misspelled.","commonSituations":"Deleting or renaming an aggregate expression without updating references, cross-subgraph references that aren't imported, typos in qualified names.","solutions":["Check the spelling and subgraph of the aggregate_expression reference","Define the missing aggregate expression in metadata","If it lives in another subgraph, reference the correct qualified name or move the definition"],"exampleFix":"# before\naggregate_expression: orders.MeanOrderValue   # not defined\n\n# after\naggregate_expression: analytics.MeanOrderValue   # correct subgraph","handlingStrategy":"validation","validationCode":"fn aggregate_expression_exists(metadata: &Metadata, name: &Qualified<AggregateExpressionName>) -> bool {\n    metadata.aggregate_expressions.contains_key(name)\n}","typeGuard":null,"tryCatchPattern":"if let AggregateBooleanExpressionError::AggregateExpressionNotFound { aggregate_expression } = err {\n    eprintln!(\"define or fix reference to {aggregate_expression:?}\");\n}","preventionTips":["Verify qualified names (subgraph + name) before referencing","Remove references when deleting/renaming aggregate expressions","Keep an index of defined vs referenced aggregate expressions in CI"],"tags":["metadata","aggregate-expression","unresolved-reference"],"backgroundTag":"unresolved-metadata-reference","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}