hasura/graphql-engine · error · AggregateBooleanExpressionError

boolean expressions with aggregate operands do not support i

Error message

boolean expressions with aggregate operands do not support isNull comparisons

What it means

AggregateBooleanExpressionError::IsNullComparisonsNotSupported: within a boolean expression with aggregate operands, the isNull comparison operator is explicitly not supported, and using it triggers this error during metadata resolution.

Source

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

#[derive(Debug, thiserror::Error)]
#[error("error in boolean expression type '{type_name}': {error}")]
pub struct NamedAggregateBooleanExpressionError {
    pub type_name: Qualified<CustomTypeName>,
    pub error: AggregateBooleanExpressionError,
}

impl ContextualError for NamedAggregateBooleanExpressionError {
    fn create_error_context(&self) -> Option<error_context::Context> {
        None
    }
}

#[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>,

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Remove isNull from the comparable/operand comparison list of the aggregate boolean expression
  2. Perform null checks on the underlying fields before aggregation instead
  3. Restructure the expression to use supported comparisons like _eq/_gt on aggregate results

Example fix

# before
comparable:
  operators: [isNull, eq]
# with aggregate operands

# after
comparable:
  operators: [eq]
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_OPS: &[&str] = &["eq", "neq", "gt", "lt", "gte", "lte"];
fn ops_supported(ops: &[String]) -> bool {
    ops.iter().all(|o| SUPPORTED_OPS.contains(&o.as_str()))
}

Try / catch

if let AggregateBooleanExpressionError::IsNullComparisonsNotSupported = err {
    eprintln!("remove isNull from the aggregate expression's comparisons");
}

Prevention

When it happens

Trigger: Including an isNull (null-check) comparison in the comparable operators of an aggregate boolean expression type.

Common situations: Copying a regular boolean expression definition (which commonly allows isNull) into an aggregate one; assuming all standard comparison operators transfer to aggregate operands.

Related errors


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