hasura/graphql-engine · error · AggregateBooleanExpressionError
the object type of the target of the relationship '{relation
Error message
the object type of the target of the relationship '{relationship_name}' ({relationship_target_object_type}) does not match the operand type of the boolean expression type '{boolean_expression_type}': '{boolean_expression_operand_type}' What it means
For a comparable relationship, the resolver verified the boolean expression type has an object aggregate operand, but that operand's object type differs from the object type of the relationship's target. The relationship target and the boolean expression operand must denote the same object type so the generated comparison is well-typed.
Source
Thrown at v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs:345
#[error(
"the comparable relationship '{relationship_name}' for the operand type '{operand_type}' references a boolean expression type that cannot be found: '{boolean_expression_type}'"
)]
ComparableRelationshipBooleanExpressionNotFound {
operand_type: Qualified<CustomTypeName>,
relationship_name: open_dds::relationships::RelationshipName,
boolean_expression_type: Qualified<CustomTypeName>,
},
#[error(
"the boolean expression type '{boolean_expression_type}' used in the comparable relationship '{relationship_name}' does not have an object aggregate operand"
)]
ComparableRelationshipBooleanExpressionIncorrectOperandType {
relationship_name: open_dds::relationships::RelationshipName,
boolean_expression_type: Qualified<CustomTypeName>,
},
#[error(
"the object type of the target of the relationship '{relationship_name}' ({relationship_target_object_type}) does not match the operand type of the boolean expression type '{boolean_expression_type}': '{boolean_expression_operand_type}'"
)]
ComparableRelationshipBooleanExpressionTypeMismatch {
relationship_name: open_dds::relationships::RelationshipName,
relationship_target_object_type: Qualified<CustomTypeName>,
boolean_expression_type: Qualified<CustomTypeName>,
boolean_expression_operand_type: Qualified<CustomTypeName>,
},
#[error("the filter input model '{model_name}' cannot be found")]
FilterInputModelNotFound { model_name: Qualified<ModelName> },
#[error(
"the operand type '{operand_type}' does not match the type of the model '{model_name}': '{model_type}'"
)]
FilterInputModelTypeMismatch {
operand_type: Qualified<CustomTypeName>,
model_name: Qualified<ModelName>,View on GitHub (pinned to 724551b9ae)
Solutions
- Align the boolean expression type's object aggregate operand type with the relationship's target object type (the error prints both).
- Or change the relationship's target_object_type to the operand type shown as boolean_expression_operand_type.
- Regenerate/derive the boolean expression type from the intended target type so they cannot drift.
Example fix
# before # relationship target: Article boolean_expression_type: AuthorBoolExp # operand type: Author # after # relationship target: Article boolean_expression_type: ArticleBoolExp # operand type: Article
Defensive patterns
Strategy: validation
Validate before calling
for rel in &metadata.comparable_relationships {
let operand_type = object_aggregate_operand_type(&rel.boolean_expression_type);
if let Some(t) = operand_type {
assert_eq!(t, rel.target_object_type,
"target {} does not match bool exp operand {}", rel.target_object_type, t);
}
} Try / catch
match resolve_metadata(docs) {
Err(e) => match e {
ResolveError::Stage(StageError::AggregateBooleanExpressions(
NamedAggregateBooleanExpressionIssue { issue, .. })) if matches!(issue,
AggregateBooleanExpressionIssue::ComparableRelationshipBooleanExpressionTypeMismatch { .. }) => {
// report both type names to guide the fix
}
other => return Err(other.into()),
},
Ok(resolved) => { /* ... */ }
} Prevention
- Keep a single source of truth mapping object types to their boolean expression types.
- When renaming a target type, grep for all boolean_expression_type references.
When it happens
Trigger: A comparable relationship with target_object_type B whose boolean_expression_type's object aggregate operand is typed C (C != B); e.g. relationship targets Article but the bool exp operand is typed Author.
Common situations: Renaming or swapping target types without updating the boolean expression type; copy-pasting a comparable relationship config and changing only the target; using a shared boolean expression type across multiple target types.
Related errors
- type mismatch between the aggregation function '{aggregation
- the operand type '{operand_type}' does not match the operand
- the type of the comparable field '{field_name}' ({field_type
- the boolean expression type '{boolean_expression_type}' used
- The field {field_name:} has type {field_type:} but the field
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/55405c6a060e4d6b.
Report an issue: GitHub.