hasura/graphql-engine · error · InternalDeveloperError

The aggregation function

Error message

The aggregation function {aggregation_function} operating over the {aggregate_operand_type} type is missing a data connector mapping for {data_connector_name}

What it means

An aggregation function (e.g. avg, sum) used in a query has no mapping for the given data connector for the operand type. Each connector declares which aggregation functions it supports per type; using an unsupported combination fails at IR resolution.

Solutions

  1. Use an aggregation function the connector supports for that operand type
  2. Cast or model the column as a type the connector can aggregate (e.g. numeric)
  3. Extend the connector's aggregation mappings if you own the connector
  4. Perform the aggregation client-side or via a custom command if unsupported

Example fix

# before
query { songs_aggregate { agg { avg { release_year } } } }
# after
query { songs_aggregate { agg { max { release_year } } } }
Defensive patterns

Strategy: fallback

Validate before calling

// Check connector capabilities before using an aggregation
const supported = connectorCapabilities.aggregationsFor('avg', 'date');
if (!supported) useFallback();

Type guard

const canAggregate = (caps, fn, type) =>
  caps.aggregation_functions?.some(f => f.name === fn && foperand_types?.includes(type));

Try / catch

// On this error, retry with a supported function (max/min) or fetch rows and aggregate client-side

Prevention

When it happens

Trigger: Using avg() on a column whose type the connector (e.g. a specific database) cannot aggregate; querying through a connector that lacks an aggregation mapping for that function/type pair; switching data sources to one with narrower aggregation support.

Common situations: Using date/time or string columns with numeric aggregation functions; expecting Postgres-level aggregation support from a limited connector; upgrading a connector that dropped support for a function.

Related errors


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

Appendix: source

Thrown at v3/crates/graphql/ir/src/error.rs:222

    #[error("The field '{field_name}' was not found on object type '{object_type_name}'")]
    ObjectTypeFieldNotFound {
        field_name: FieldName,
        object_type_name: Qualified<CustomTypeName>,
    },

    #[error("{0}")]
    RelationshipFieldMappingError(#[from] plan::RelationshipFieldMappingError),

    #[error(
        "Argument mapping not found for the argument {argument_name:} while executing the relationship {relationship_name:}"
    )]
    ArgumentMappingNotFoundForRelationship {
        relationship_name: RelationshipName,
        argument_name: ArgumentName,
    },

    #[error(
        "The aggregation function {aggregation_function} operating over the {aggregate_operand_type} type is missing a data connector mapping for {data_connector_name}"
    )]
    DataConnectorAggregationFunctionNotFound {
        aggregate_operand_type: QualifiedTypeName,
        aggregation_function: AggregationFunctionName,
        data_connector_name: Qualified<DataConnectorName>,
    },

    #[error(
        "A field ({field_name}) with an AggregatableField annotation was found on a scalar-typed ({aggregate_operand_type}) operand's selection set"
    )]
    AggregatableFieldFoundOnScalarTypedOperand {
        field_name: FieldName,
        aggregate_operand_type: QualifiedTypeName,
    },

    #[error(
        "The aggregation function {aggregation_function} was used on the model object type and not on a model field. Aggregation functions operate on columns, not rows"

View on GitHub (pinned to 724551b9ae)