hasura/graphql-engine · error · ObjectTypesIssue
Multiple {function_name} aggregate functions found for type
Error message
Multiple {function_name} aggregate functions found for type {scalar_type} in data connector {data_connector_name} What it means
More than one aggregate function with the same function_name is declared for the same scalar type in one data connector. Aggregate function names must be unique per (scalar type, connector) so the resolver can map aggregation fields deterministically.
Source
Thrown at v3/crates/metadata-resolve/src/stages/object_types/types.rs:450
/// Mapping from an object to their fields, which contain the types of fields.
Object {
ndc_object_type_name: DataConnectorObjectType,
field_mappings: Arc<BTreeMap<FieldName, FieldMapping>>,
},
}
#[allow(clippy::enum_variant_names)]
#[derive(Debug, thiserror::Error)]
pub enum ObjectTypesIssue {
#[error(
"Multiple {operator_name} operators found for type {scalar_type} in data connector {data_connector_name}"
)]
DuplicateOperatorsDefined {
scalar_type: ndc_models::ScalarTypeName,
operator_name: String,
data_connector_name: Qualified<DataConnectorName>,
},
#[error(
"Multiple {function_name} aggregate functions found for type {scalar_type} in data connector {data_connector_name}"
)]
DuplicateAggregateFunctionsDefined {
scalar_type: ndc_models::ScalarTypeName,
function_name: String,
data_connector_name: Qualified<DataConnectorName>,
},
#[error(
"Multiple {function_name} extraction functions found for type {scalar_type} in data connector {data_connector_name}"
)]
DuplicateExtractionFunctionsDefined {
scalar_type: ndc_models::ScalarTypeName,
function_name: String,
data_connector_name: Qualified<DataConnectorName>,
},
#[error(
"the field {field_name:} in {type_name:} should have the type {expected:} for data connector {data_connector:} but the field has type {provided:}"
)]View on GitHub (pinned to 724551b9ae)
Solutions
- Search the aggregate functions section for the scalar type in that connector and delete the duplicate function_name entry
- Rely on the connector's built-in aggregate functions instead of redefining them
- Regenerate aggregate function collections with a tool that de-duplicates
Defensive patterns
Strategy: validation
Validate before calling
const seen = new Set();
for (const fn of aggregateFunctions) {
const key = `${fn.scalar_type}/${fn.function_name}`;
if (seen.has(key)) throw new Error(`Duplicate aggregate function ${key}`);
seen.add(key);
} Prevention
- Don't redefine aggregate functions the connector already exposes
- Validate uniqueness of (type, name) pairs in metadata linting
When it happens
Trigger: Metadata or connector schema contains two aggregate function entries with identical names for a scalar type — e.g. adding a custom 'avg' aggregate when the connector already provides one.
Common situations: Hand-added aggregate functions colliding with connector-provided defaults; copy-paste errors in metadata; duplicated entries after metadata merges.
Related errors
- Multiple {operator_name} operators found for type {scalar_ty
- Multiple {function_name} extraction functions found for type
- {argument_name:} has the data type {data_type:} that has not
- the relationship '{relationship_name}' is defined more than
- the aggregate expression {name} has duplicate definitions of
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/022ef39d973589d8.
Report an issue: GitHub.