hasura/graphql-engine · error · ScalarBooleanExpressionTypeIssue

the comparable operator '{name}' is defined more than once i

Error message

the comparable operator '{name}' is defined more than once in the boolean expression type '{type_name}'

What it means

The same comparable operator name is defined more than once within a single boolean expression type.

Source

Thrown at v3/crates/metadata-resolve/src/stages/scalar_boolean_expressions/error.rs:95

    MissingIsNullOperatorNameInGraphqlConfig {
        type_name: Qualified<CustomTypeName>,
    },
    #[error(
        "the boolean expression '{type_name}' has enabled logical operators, but they will not appear in the GraphQL API unless you update your CompatibilityConfig date to at least 2024-11-26"
    )]
    LogicalOperatorsUnavailable {
        type_name: Qualified<CustomTypeName>,
    },
    #[error(
        "the boolean expression '{type_name}' has a GraphQL field name conflict between the '{name}' {name_source_1} and the '{name}' {name_source_2}. One of these will need to be renamed."
    )]
    GraphqlFieldNameConflict {
        type_name: Qualified<CustomTypeName>,
        name: String,
        name_source_1: FieldNameSource,
        name_source_2: FieldNameSource,
    },
    #[error(
        "the comparable operator '{name}' is defined more than once in the boolean expression type '{type_name}'"
    )]
    DuplicateComparableOperatorFound {
        type_name: Qualified<CustomTypeName>,
        name: OperatorName,
    },
    #[error("{0}")]
    OperatorIssue(ScalarBooleanExpressionOperatorIssue),
}

impl ShouldBeAnError for ScalarBooleanExpressionTypeIssue {
    fn should_be_an_error(&self, flags: &flags::OpenDdFlags) -> bool {
        match self {
            ScalarBooleanExpressionTypeIssue::MissingLogicalOperatorNamesInGraphqlConfig {
                ..
            }
            | ScalarBooleanExpressionTypeIssue::MissingIsNullOperatorNameInGraphqlConfig {
                ..

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Remove or rename the duplicated operator entry so each operator name is unique within the type
  2. Check for accidental merge of two boolean expression definitions with overlapping operators

Example fix

// before
operators:
  - name: equal
  - name: equal
// after
operators:
  - name: equal
  - name: less_than
Defensive patterns

Strategy: validation

Validate before calling

let mut names = HashSet::new();
for op in &be_type.comparable_operators {
    if !names.insert(op.name.clone()) {
        return Err(format!("duplicate operator: {}", op.name));
    }
}

Prevention

When it happens

Trigger: Declaring two comparable operators with identical OperatorName in one boolean expression type definition.

Common situations: Copy-pasting operator entries in metadata YAML and forgetting to change the name; merging type definitions that both define e.g. 'equal'.

Related errors


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