{"record":{"id":"022ef39d973589d8","repo":"hasura/graphql-engine","slug":"multiple-function-name-aggregate-functions-found","errorCode":null,"errorMessage":"Multiple {function_name} aggregate functions found for type {scalar_type} in data connector {data_connector_name}","messagePattern":"Multiple (.+?) aggregate functions found for type (.+?) in data connector (.+?)","errorType":"validation","errorClass":"ObjectTypesIssue","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/object_types/types.rs","lineNumber":450,"sourceCode":"    /// Mapping from an object to their fields, which contain the types of fields.\n    Object {\n        ndc_object_type_name: DataConnectorObjectType,\n        field_mappings: Arc<BTreeMap<FieldName, FieldMapping>>,\n    },\n}\n\n#[allow(clippy::enum_variant_names)]\n#[derive(Debug, thiserror::Error)]\npub enum ObjectTypesIssue {\n    #[error(\n        \"Multiple {operator_name} operators found for type {scalar_type} in data connector {data_connector_name}\"\n    )]\n    DuplicateOperatorsDefined {\n        scalar_type: ndc_models::ScalarTypeName,\n        operator_name: String,\n        data_connector_name: Qualified<DataConnectorName>,\n    },\n    #[error(\n        \"Multiple {function_name} aggregate functions found for type {scalar_type} in data connector {data_connector_name}\"\n    )]\n    DuplicateAggregateFunctionsDefined {\n        scalar_type: ndc_models::ScalarTypeName,\n        function_name: String,\n        data_connector_name: Qualified<DataConnectorName>,\n    },\n    #[error(\n        \"Multiple {function_name} extraction functions found for type {scalar_type} in data connector {data_connector_name}\"\n    )]\n    DuplicateExtractionFunctionsDefined {\n        scalar_type: ndc_models::ScalarTypeName,\n        function_name: String,\n        data_connector_name: Qualified<DataConnectorName>,\n    },\n    #[error(\n        \"the field {field_name:} in {type_name:} should have the type {expected:} for data connector {data_connector:} but the field has type {provided:}\"\n    )]","sourceCodeStart":432,"sourceCodeEnd":468,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/object_types/types.rs#L432-L468","documentation":"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.","triggerScenarios":"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.","commonSituations":"Hand-added aggregate functions colliding with connector-provided defaults; copy-paste errors in metadata; duplicated entries after metadata merges.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const seen = new Set();\nfor (const fn of aggregateFunctions) {\n  const key = `${fn.scalar_type}/${fn.function_name}`;\n  if (seen.has(key)) throw new Error(`Duplicate aggregate function ${key}`);\n  seen.add(key);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't redefine aggregate functions the connector already exposes","Validate uniqueness of (type, name) pairs in metadata linting"],"tags":["hasura","metadata","data-connectors","aggregates","duplicate"],"backgroundTag":"duplicate-definition","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}