hasura/graphql-engine · error · AggregateExpressionError

the aggregate expression {name} defines an aggregation funct

Error message

the aggregate expression {name} defines an aggregation function mapping to a data connector that does not support aggregates: {data_connector_name}

What it means

The aggregate expression maps to a data connector whose capabilities do not include aggregate support. Even though the connector exists, it advertises no aggregation functions, so the mapping cannot be satisfied.

Source

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

    #[error(
        "the aggregate expression {name} specifies an aggregation function '{function_name}' that uses an unknown type for its return type: {type_name}"
    )]
    AggregateOperandFunctionUnknownReturnType {
        name: Qualified<AggregateExpressionName>,
        function_name: AggregationFunctionName,
        type_name: CustomTypeName,
    },

    #[error(
        "the aggregate expression {name} defines an aggregation function mapping to an unknown data connector: {data_connector_name}"
    )]
    AggregateOperandDataConnectorMissing {
        name: Qualified<AggregateExpressionName>,
        data_connector_name: Qualified<DataConnectorName>,
    },

    #[error(
        "the aggregate expression {name} defines an aggregation function mapping to a data connector that does not support aggregates: {data_connector_name}"
    )]
    AggregateOperandDataConnectorNotSupported {
        name: Qualified<AggregateExpressionName>,
        data_connector_name: Qualified<DataConnectorName>,
    },

    #[error(
        "the aggregate expression {name} specifies an aggregation function '{function_name}' but there is no mapping defined to an aggregation function in the data connector '{data_connector_name}'"
    )]
    AggregateOperandDataConnectorFunctionMappingMissing {
        name: Qualified<AggregateExpressionName>,
        function_name: AggregationFunctionName,
        data_connector_name: Qualified<DataConnectorName>,
    },

    #[error(
        "the aggregate expression {name} specifies an aggregation function '{function_name}' but the mapping to the data connector '{data_connector_name}' specifies a data connector scalar type that does not exist: {scalar_type}"

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Check the connector's capabilities (e.g. its NDC /capabilities endpoint) for aggregate functions support
  2. Upgrade the connector to a version that supports aggregates
  3. Re-point the aggregate expression's mapping to a connector that does support aggregates (e.g. the Postgres NDC connector)
  4. If aggregates aren't needed for that connector, remove the mapping

Example fix

# before
data_connector_mappings:
  - data_connector_name: default/my_custom_connector # no aggregate capability
# after
data_connector_mappings:
  - data_connector_name: default/postgres
Defensive patterns

Strategy: validation

Validate before calling

# Before adding an aggregate mapping, query the connector capabilities:
# curl http://connector:8080/capabilities | jq '.aggregate_functions'
# Ensure the target connector appears with aggregate support before mapping it.

Prevention

When it happens

Trigger: A data connector in metadata whose NDC capabilities response (or static capability set) has no aggregate functions, referenced by an aggregate expression's `data_connector_mappings`. Resolution of the aggregates stage fails.

Common situations: Using a minimal/custom NDC connector or an older connector version that doesn't implement the NDC aggregates capability; pointing aggregate metadata at an auth/webhook-style connector; upgrading a connector that dropped aggregate support.

Related errors


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