hasura/graphql-engine · error · AggregateBooleanExpressionError
the operand type '{operand_type}' must be an object type
Error message
the operand type '{operand_type}' must be an object type What it means
AggregateBooleanExpressionError::OperandTypeIsNotAnObjectType: the aggregate boolean expression's operand must be an object type in this position, but the declared operand type resolves to something else (e.g. a scalar). The message includes the offending operand type.
Source
Thrown at v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs:142
}
#[derive(Debug, thiserror::Error)]
pub enum AggregateBooleanExpressionError {
#[error("boolean expressions with aggregate operands are not supported")]
AggregateBooleanExpressionsNotSupported,
#[error("boolean expressions with aggregate operands do not support isNull comparisons")]
IsNullComparisonsNotSupported,
#[error("{0}")]
GraphqlConfigError(#[from] GraphqlConfigError),
#[error("the operand type '{operand_type}' must be a scalar type")]
OperandTypeIsNotAScalarType {
operand_type: Qualified<CustomTypeName>,
},
#[error("the operand type '{operand_type}' must be an object type")]
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,
},
View on GitHub (pinned to 724551b9ae)
Solutions
- Set the operand type to the object type being filtered
- Verify the object type exists in the same subgraph and is spelled correctly
- Re-read the aggregate boolean expression definition to confirm operand roles
Example fix
# before operand: type: app.UserStatus # scalar # after operand: type: app.User # object type
Defensive patterns
Strategy: validation
Validate before calling
fn operand_is_object(metadata: &Metadata, operand: &Qualified<CustomTypeName>) -> bool {
metadata.object_types.contains_key(operand)
} Try / catch
if let AggregateBooleanExpressionError::OperandTypeIsNotAnObjectType { operand_type } = err {
eprintln!("{operand_type:?} must be declared as an object type");
} Prevention
- Confirm operand roles (object vs scalar) when authoring aggregate expressions
- Validate against the object type registry in a pre-deploy check
When it happens
Trigger: Declaring the target operand of an aggregate boolean expression with a scalar type where the definition requires an object type (the type whose fields are being aggregated/compared).
Common situations: Pointing the operand at a scalar by mistake, renaming types so the operand now resolves to a scalar, misunderstanding which side of the expression must be the object type.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- error in boolean expression type '{type_name}': {error}
- boolean expressions with aggregate operands are not supporte
- boolean expressions with aggregate operands do not support i
- {0}
- the operand type '{operand_type}' must be a scalar type
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/fbff53e60c778a9b.
Report an issue: GitHub.