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 an unknown data connector: {data_connector_name}

What it means

An aggregation function mapping inside an aggregate expression references a data connector by name, but no data connector with that name exists in the resolved metadata. The resolver needs the connector to look up its supported aggregate functions.

Source

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

    #[error(
        "the aggregate expression {name} has duplicate definitions of the aggregation function '{function_name}'"
    )]
    AggregateOperandFunctionDuplicated {
        name: Qualified<AggregateExpressionName>,
        function_name: AggregationFunctionName,
    },

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

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Compare the connector name in the error with the `data_connector_name` in your datasource metadata files
  2. Fix the name in the aggregate expression's mapping to exactly match the configured connector
  3. If the connector was removed, delete the stale mapping from the aggregate expression
  4. Regenerate metadata via `ddn build` rather than editing by hand

Example fix

# before
data_connector_mappings:
  - data_connector_name: main_pg # no such connector
# after
data_connector_mappings:
  - data_connector_name: default/postgres
Defensive patterns

Strategy: validation

Validate before calling

connector_names = {d['name'] for d in datasources}
for m in agg_expr.get('data_connector_mappings', []):
    assert m['data_connector_name'] in connector_names, f"unknown connector {m['data_connector_name']}"

Prevention

When it happens

Trigger: A `data_connector_mappings` entry in an aggregate expression whose `data_connector_name` does not match any configured data connector (datasource) in the metadata.

Common situations: Renaming a data source (`ddn connector rename` or editing the datasource YAML) without updating aggregate expressions; removing an old connector; environment-specific connector names differing between dev and prod metadata; typo in the connector name.

Related errors


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