hasura/graphql-engine · warning · AggregateExpressionIssue

the aggregate expression {name} defines a graphql section bu

Error message

the aggregate expression {name} defines a graphql section but it will not appear in the GraphQL API unless {config_name} is also configured in the GraphqlConfig

What it means

An aggregate expression declares a graphql section, but a required piece of the GraphqlConfig ({config_name}) is not configured, so the aggregate expression will not be exposed in the GraphQL API. This warns that the per-expression graphql section is ineffective without the global config entry.

Source

Thrown at v3/crates/metadata-resolve/src/stages/aggregates/types.rs:90

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
pub struct DataConnectorAggregationFunctionInfo {
    pub data_connector_name: Qualified<DataConnectorName>,
    pub function_name: DataConnectorAggregationFunctionName,
    pub operand_scalar_type: DataConnectorScalarType,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
pub struct AggregateExpressionGraphqlConfig {
    pub count_field_name: ast::Name,
    pub count_distinct_field_name: ast::Name,

    pub select_output_type_name: ast::TypeName,
}

#[derive(Debug, thiserror::Error, PartialEq, Eq, Clone)]
pub enum AggregateExpressionIssue {
    #[error(
        "the aggregate expression {name} defines a graphql section but it will not appear in the GraphQL API unless {config_name} is also configured in the GraphqlConfig"
    )]
    ConfigMissingFromGraphQlConfig {
        name: Qualified<AggregateExpressionName>,
        config_name: String,
    },
}

#[derive(Debug, thiserror::Error)]
pub enum AggregateExpressionError {
    #[error("the following aggregate expression is defined more than once: {name}")]
    DuplicateAggregateExpressionDefinition {
        name: Qualified<AggregateExpressionName>,
    },

    #[error(
        "the name used by {config_name} from the GraphqlConfig conflicts with the aggregatable field name {aggregatable_field_name} in the aggregate expression {name}"
    )]

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Add the missing {config_name} section to your GraphqlConfig (e.g. query.aggregate with the relevant field/filter names).
  2. Or remove the graphql section from the aggregate expression if GraphQL exposure is not intended.

Example fix

# before
aggregate_expressions:
  my_avg:
    graphql: {}
# GraphqlConfig missing query.aggregate
# after
query:
  aggregate:
    count:
      field_name: count
      filter_name: filter
Defensive patterns

Strategy: validation

Validate before calling

for expr in &metadata.aggregate_expressions {
    if expr.graphql.is_some() {
        assert!(graphql_config_has(&cfg, &required_config_for(expr)),
            "aggregate expression {} declares graphql but {} is missing",
            expr.name, required_config_name(expr));
    }
}

Prevention

When it happens

Trigger: An aggregate expression with a graphql: {} block while the GraphqlConfig is missing the related config, e.g. query.aggregate (or the specific naming config named by {config_name}) is not set.

Common situations: Enabling GraphQL exposure on an aggregate expression without adding the matching global GraphqlConfig section; upgrading to a metadata schema where aggregate GraphQL naming is centralized.

Related errors


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