hasura/graphql-engine · error · AggregateBooleanExpressionError

the type of the comparable field '{field_name}' ({field_type

Error message

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}'

What it means

A stricter variant of the operand check: the field's resolved QualifiedTypeName must equal the operand type declared by the boolean expression type used for that comparable field. If the two qualified type names differ (e.g. different scalar names or different type kinds), resolution aborts with this mismatch error.

Source

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

    #[error(
        "the boolean expression type ({boolean_expression_type}) used in the comparable field '{field_name}' could not be found"
    )]
    ComparableFieldBooleanExpressionNotFound {
        field_name: FieldName,
        boolean_expression_type: Qualified<CustomTypeName>,
    },

    #[error(
        "the boolean expression type ({boolean_expression_type}) used in the comparable field '{field_name}' must have a '{aggregate_operand_type}' operand, to match the field type '{field_type}'"
    )]
    ComparableFieldBooleanExpressionIncorrectOperandType {
        boolean_expression_type: Qualified<CustomTypeName>,
        aggregate_operand_type: AggregateOperandType,
        field_name: FieldName,
        field_type: QualifiedTypeName,
    },

    #[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}'"

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Align the field's type with the operand type: either change the field's scalar or update the bool exp type's operand to the same qualified type name
  2. If a custom scalar is used, make sure both the field and the operand reference the identical qualified name
  3. Regenerate boolean expression types from the current model schema after type renames

Example fix

// before
field: { name: rating, type: Float }
boolExpOperand: numeric_comparison_exp  // operand type is Int

// after
field: { name: rating, type: Float }
boolExpOperand: float_comparison_exp    // operand type is Float
Defensive patterns

Strategy: validation

Validate before calling

assert_eq!(
    qualified_name_of(field.field_type),
    bool_exp_type.operand_type,
    "field type and bool exp operand type must match exactly"
);

Prevention

When it happens

Trigger: The comparable field's type is QualifiedTypeName A while the boolean expression type's operand is QualifiedTypeName B, with A != B, during resolution of the boolean expression type's comparable fields.

Common situations: Renaming a scalar type in one place but not the other; using custom scalar names (e.g. MyInt vs Int) inconsistently between the model field and the boolean expression type operands; copy-pasting bool exp definitions between models with different scalar sets.

Related errors


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