{"record":{"id":"8c7ccf7128bb8f14","repo":"hasura/graphql-engine","slug":"the-operand-type-operand-type-does-not-match-t","errorCode":null,"errorMessage":"the operand type '{operand_type}' does not match the operand type '{aggregate_operand}' from the aggregate expression '{aggregate_expression}'","messagePattern":"the operand type '(.+?)' does not match the operand type '(.+?)' from the aggregate expression '(.+?)'","errorType":"validation","errorClass":"AggregateBooleanExpressionError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs","lineNumber":152,"sourceCode":"    #[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,\n    },\n\n    #[error(\n        \"the aggregation function '{aggregation_function_name}' is not defined in the aggregate expression '{aggregate_expression}'\"\n    )]","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs#L134-L170","documentation":"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.","triggerScenarios":"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.","commonSituations":"Renaming or retyping the operand on the aggregate expression without updating dependent boolean expressions, copy-pasting boolean expressions across domains.","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"],"exampleFix":"# before\noperand: app.Order          # boolean expression\naggregate_expression: stats.MaxUserScore   # operand: app.User\n\n# after\naggregate_expression: stats.MaxOrderTotal  # operand: app.Order","handlingStrategy":"validation","validationCode":"fn operands_match(\n    boolean_expr_operand: &QualifiedTypeName,\n    aggregate: &AggregateExpression,\n) -> bool {\n    &aggregate.operand_type == boolean_expr_operand\n}","typeGuard":null,"tryCatchPattern":"if let AggregateBooleanExpressionError::AggregateOperandTypeMismatch { operand_type, aggregate_operand, aggregate_expression } = err {\n    eprintln!(\"{operand_type:?} != {aggregate_operand:?} on {aggregate_expression:?}\");\n}","preventionTips":["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"],"tags":["metadata","aggregate-expression","type-mismatch"],"backgroundTag":"schema-validation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}