hasura/graphql-engine · warning · AggregateBooleanExpressionIssue

a aggregation is defined but it will not appear in the…

Error message

a {count_type} aggregation is defined but it will not appear in the GraphQL API unless count aggregate field names are also configured in the GraphqlConfig in query.aggregate

What it means

A count-type aggregation (count or count distinct, per CountAggregateType) is defined on a boolean expression type, but the GraphqlConfig does not configure count aggregate field names in query.aggregate, so the count aggregation will not appear in the GraphQL API.

Solutions

  1. Add count aggregate field names to query.aggregate in the GraphqlConfig (e.g. count: count, count_distinct: count_distinct or your preferred names).
  2. Or drop the count aggregation from the boolean expression type if it is not needed in the API.

Example fix

# before
# aggregation defined: count
# query.aggregate not configured
# after
query:
  aggregate:
    count:
      field_name: count
      filter_name: filter
Defensive patterns

Strategy: validation

Validate before calling

fn count_aggregations_visible(be: &BooleanExpressionType, cfg: &GraphqlConfig) -> bool {
    let has_count = be.aggregations.iter().any(|a| matches!(a.function, Count | CountDistinct));
    !has_count || cfg.query.aggregate.and_then(|a| a.count).is_some()
}

Prevention

When it happens

Trigger: Boolean expression operand aggregations including a count/count-distinct aggregation while query.aggregate in the GraphqlConfig lacks count_aggregate field name configuration.

Common situations: Adding count aggregations to filter expressions without configuring their GraphQL field names; metadata versions where aggregate naming moved into the global GraphqlConfig.

Related errors


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

Appendix: source

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

    #[display("count distinct aggregation function")]
    CountDistinctAggregationFunction,
}

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

#[derive(Debug, thiserror::Error)]
pub enum AggregateBooleanExpressionIssue {
    #[error(
        "a graphql section is defined but it will not appear in the GraphQL API unless logical operator field names are also configured in the GraphqlConfig in query.filterInputConfig"
    )]
    MissingLogicalOperatorNamesInGraphqlConfig,

    #[error(
        "a {count_type} aggregation is defined but it will not appear in the GraphQL API unless count aggregate field names are also configured in the GraphqlConfig in query.aggregate"
    )]
    MissingCountAggregationNamesInGraphqlConfig { count_type: CountAggregateType },
}

View on GitHub (pinned to 724551b9ae)