hasura/graphql-engine · error · AggregateBooleanExpressionError
the comparable relationship '{relationship_name}' for the op
Error message
the comparable relationship '{relationship_name}' for the operand type '{operand_type}' is an array relationship. This is not supported What it means
Comparable relationships must be object (single) relationships; array relationships are rejected because nested aggregate boolean expressions over array relationships are not supported by this stage.
Source
Thrown at v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs:311
},
#[error(
"the comparable relationship '{relationship_name}' was not found for the operand type '{operand_type}'"
)]
ComparableRelationshipNotFound {
operand_type: Qualified<CustomTypeName>,
relationship_name: RelationshipName,
},
#[error(
"the comparable relationship '{relationship_name}' for the operand type '{operand_type}' targets a command. This is not supported"
)]
ComparableRelationshipCommandTargetNotSupported {
operand_type: Qualified<CustomTypeName>,
relationship_name: RelationshipName,
},
#[error(
"the comparable relationship '{relationship_name}' for the operand type '{operand_type}' is an array relationship. This is not supported"
)]
ComparableArrayRelationshipNotSupported {
operand_type: Qualified<CustomTypeName>,
relationship_name: RelationshipName,
},
#[error(
"the comparable relationship '{relationship_name}' for the operand type '{operand_type}' targets a model than cannot be found: '{target_model_name}'"
)]
ComparableRelationshipTargetModelNotFound {
operand_type: Qualified<CustomTypeName>,
relationship_name: open_dds::relationships::RelationshipName,
target_model_name: Qualified<open_dds::models::ModelName>,
},
#[error(
"the comparable relationship '{relationship_name}' for the operand type '{operand_type}' references a boolean expression type that cannot be found: '{boolean_expression_type}'"View on GitHub (pinned to 724551b9ae)
Solutions
- Remove the array relationship from comparableRelationships
- Restructure the metadata so aggregation goes through an object relationship to a type that models the child collection
- Filter on the child side or via a dedicated aggregate model/relationship instead
Example fix
# before
# Author --articles--> [Article] (array relationship)
comparableRelationships:
- relationshipName: articles
# after
comparableRelationships:
- relationshipName: profile # object relationship only
# query aggregates on Article directly: article_aggregate(where: {rating: {_gt: 4}}) Defensive patterns
Strategy: validation
Validate before calling
for r in &comparable_relationships {
let rel = operand_type.relationships[&r.relationship_name];
assert!(!rel.is_array(), "array relationship cannot be comparable");
} Prevention
- Remember nested aggregate bool exp only supports object relationships
- Model child-side filtering instead of parent-side aggregation over arrays
When it happens
Trigger: Marking an array (many) relationship as a comparable relationship for aggregate boolean expressions.
Common situations: Trying to filter parents by aggregates of their children (e.g. authors where their articles' avg rating > x) by marking the articles array relationship as comparable, which this feature does not support; misunderstanding which relationship kinds allow nested aggregation.
Related errors
- the type of the comparable field '{field_name}' ({field_type
- the boolean expression type ({boolean_expression_type}) used
- the comparable relationship '{relationship_name}' for the op
- Condition {condition_hash} not found
- could not find a scalar-operanded boolean expression type na
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/3db710804ddbc265.
Report an issue: GitHub.