hasura/graphql-engine · error · AggregateBooleanExpressionError

a GraphQL field name conflict exists between the '{name}' {n

Error message

a GraphQL field name conflict exists between the '{name}' {name_source_1} and the '{name}' {name_source_2}. One of these will need to be renamed.

What it means

Two distinct metadata constructs would generate GraphQL fields with the same name in the same boolean expression / aggregate filter input type, producing an invalid schema. The error identifies both name sources; one must be renamed because GraphQL does not allow duplicate field names within a type.

Source

Thrown at v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs:367

        relationship_name: open_dds::relationships::RelationshipName,
        relationship_target_object_type: Qualified<CustomTypeName>,
        boolean_expression_type: Qualified<CustomTypeName>,
        boolean_expression_operand_type: Qualified<CustomTypeName>,
    },

    #[error("the filter input model '{model_name}' cannot be found")]
    FilterInputModelNotFound { model_name: Qualified<ModelName> },

    #[error(
        "the operand type '{operand_type}' does not match the type of the model '{model_name}': '{model_type}'"
    )]
    FilterInputModelTypeMismatch {
        operand_type: Qualified<CustomTypeName>,
        model_name: Qualified<ModelName>,
        model_type: Qualified<CustomTypeName>,
    },

    #[error(
        "a GraphQL field name conflict exists between the '{name}' {name_source_1} and the '{name}' {name_source_2}. One of these will need to be renamed."
    )]
    GraphqlNameConflict {
        name: String,
        name_source_1: NameSource,
        name_source_2: NameSource,
    },
}

#[derive(Debug, Eq, PartialEq, Copy, Clone, derive_more::with_trait::Display)]
pub enum AggregateOperandType {
    #[display("object aggregate")]
    ObjectAggregate,
    #[display("scalar aggregate")]
    ScalarAggregate,
}

#[derive(Debug, Eq, PartialEq, Copy, Clone, derive_more::with_trait::Display)]

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Rename one of the two sources listed in the error (the field name mapping for the operand, or the logical operator / count aggregation name in GraphqlConfig).
  2. If the collision comes from filterInputConfig, pick operator names like _and/_or/_not that do not collide with operand names.
  3. If the collision is between aggregate field names, give each aggregation a distinct graphql_name.

Example fix

# before
query:
  filterInputConfig:
    logical_operator_names:
      and: name   # collides with operand field 'name'
# after
query:
  filterInputConfig:
    logical_operator_names:
      and: _and
Defensive patterns

Strategy: validation

Validate before calling

fn assert_no_name_conflicts(bool_exp: &BooleanExpressionType, config: &GraphqlConfig) {
    let mut seen: HashMap<String, NameSource> = HashMap::new();
    let entries = configured_field_names(bool_exp, config); // (graphql_name, NameSource)
    for (name, source) in entries {
        if let Some(prev) = seen.insert(name.clone(), source.clone()) {
            panic!("GraphQL field name conflict: {} ({:?} vs {:?})", name, prev, source);
        }
    }
}

Prevention

When it happens

Trigger: Configuring a logical operator field name, count aggregation field name, or operand field name in the GraphqlConfig that collides with another operand's GraphQL name (e.g. naming the _and logical operator the same as an operand field, or two aggregations mapping to the same field name).

Common situations: Customizing query.filterInputConfig or query.aggregate names to friendly names that clash with existing field names; adding a new operand whose GraphQL name matches a configured count/logical field; multiple aggregate expressions sharing graphql_name.

Related errors


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