hasura/graphql-engine · error · AggregateBooleanExpressionError

the comparable relationship '{relationship_name}' was not fo

Error message

the comparable relationship '{relationship_name}' was not found for the operand type '{operand_type}'

What it means

A comparable relationship references a relationship by name on a given operand type, but no relationship with that name exists on that type. The resolver looks up the relationship on the operand's type and fails, since aggregation over it cannot be built.

Source

Thrown at v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs:295

    #[error(
        "the type of the comparable field '{field_name}' ({field_type}) does not match the operand type of the boolean expression type '{boolean_expression_type}': '{boolean_expression_operand_type}'"
    )]
    ComparableFieldBooleanExpressionTypeMismatch {
        field_name: FieldName,
        field_type: QualifiedTypeName,
        boolean_expression_type: Qualified<CustomTypeName>,
        boolean_expression_operand_type: QualifiedTypeName,
    },

    #[error(
        "the relationship '{relationship_name}' is defined more than once in the comparable relationships"
    )]
    DuplicateComparableRelationshipsFound {
        relationship_name: open_dds::relationships::RelationshipName,
    },

    #[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"
    )]

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Check the exact relationship name on the operand type and correct the comparableRelationships entry
  2. Define the missing relationship on the operand type if it was intended
  3. After renaming relationships, update all comparable relationship references

Example fix

# before
# type Author has relationship 'writtenArticles'
comparableRelationships:
  - relationshipName: articles   # wrong name

# after
comparableRelationships:
  - relationshipName: writtenArticles
Defensive patterns

Strategy: validation

Validate before calling

for r in &comparable_relationships {
    assert!(operand_type.relationships.contains_key(&r.relationship_name),
        "relationship {} not defined on operand type", r.relationship_name);
}

Prevention

When it happens

Trigger: The comparableRelationships list names a relationship that is not defined on the boolean expression type's operand type (typos, renames, or referencing a relationship defined on a different type).

Common situations: Renaming a relationship in relationships.yaml without updating the comparable relationships list; misspelling the relationship name; referencing a relationship that belongs to another model/type in the same subgraph.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/fb27a6ad59879a98. Report an issue: GitHub.