{"record":{"id":"ef8f019e5c735f78","repo":"hasura/graphql-engine","slug":"the-aggregation-function-aggregation-function-op","errorCode":null,"errorMessage":"The aggregation function {aggregation_function} operating over the {aggregate_operand_type} type is missing a data connector mapping for {data_connector_name}","messagePattern":"The aggregation function (.+?) operating over the (.+?) type is missing a data connector mapping for (.+?)","errorType":"exception","errorClass":"InternalDeveloperError","httpStatus":null,"severity":"error","filePath":"v3/crates/graphql/ir/src/error.rs","lineNumber":222,"sourceCode":"\n    #[error(\"The field '{field_name}' was not found on object type '{object_type_name}'\")]\n    ObjectTypeFieldNotFound {\n        field_name: FieldName,\n        object_type_name: Qualified<CustomTypeName>,\n    },\n\n    #[error(\"{0}\")]\n    RelationshipFieldMappingError(#[from] plan::RelationshipFieldMappingError),\n\n    #[error(\n        \"Argument mapping not found for the argument {argument_name:} while executing the relationship {relationship_name:}\"\n    )]\n    ArgumentMappingNotFoundForRelationship {\n        relationship_name: RelationshipName,\n        argument_name: ArgumentName,\n    },\n\n    #[error(\n        \"The aggregation function {aggregation_function} operating over the {aggregate_operand_type} type is missing a data connector mapping for {data_connector_name}\"\n    )]\n    DataConnectorAggregationFunctionNotFound {\n        aggregate_operand_type: QualifiedTypeName,\n        aggregation_function: AggregationFunctionName,\n        data_connector_name: Qualified<DataConnectorName>,\n    },\n\n    #[error(\n        \"A field ({field_name}) with an AggregatableField annotation was found on a scalar-typed ({aggregate_operand_type}) operand's selection set\"\n    )]\n    AggregatableFieldFoundOnScalarTypedOperand {\n        field_name: FieldName,\n        aggregate_operand_type: QualifiedTypeName,\n    },\n\n    #[error(\n        \"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\"","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/graphql/ir/src/error.rs#L204-L240","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use an aggregation function the connector supports for that operand type","Cast or model the column as a type the connector can aggregate (e.g. numeric)","Extend the connector's aggregation mappings if you own the connector","Perform the aggregation client-side or via a custom command if unsupported"],"exampleFix":"# before\nquery { songs_aggregate { agg { avg { release_year } } } }\n# after\nquery { songs_aggregate { agg { max { release_year } } } }","handlingStrategy":"fallback","validationCode":"// Check connector capabilities before using an aggregation\nconst supported = connectorCapabilities.aggregationsFor('avg', 'date');\nif (!supported) useFallback();","typeGuard":"const canAggregate = (caps, fn, type) =>\n  caps.aggregation_functions?.some(f => f.name === fn && foperand_types?.includes(type));","tryCatchPattern":"// On this error, retry with a supported function (max/min) or fetch rows and aggregate client-side","preventionTips":["Consult the connector's supported aggregations docs","Model numeric columns for numeric aggregations","Feature-detect aggregations per data source"],"tags":["graphql","aggregation","data-connector","ndc"],"backgroundTag":"unsupported-aggregation-function","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}