hasura/graphql-engine · error · BooleanExpressionIssue::DuplicateComparableRelationshipFound

the comparable relationship '{name}' is defined more than on

Error message

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

What it means

The same comparable relationship name is declared more than once in a boolean expression type. Relationship names within a boolean expression must be unique.

Source

Thrown at v3/crates/metadata-resolve/src/stages/boolean_expressions/types.rs:51

        field_type: QualifiedTypeReference,
    },
    #[error(
        "The data connector '{data_connector_name}' does not support filtering by nested scalar arrays. The comparable field '{field_name}' within '{boolean_expression_type_name}' is of a scalar array type: {field_type}"
    )]
    DataConnectorDoesNotSupportNestedScalarArrayFiltering {
        data_connector_name: Qualified<DataConnectorName>,
        boolean_expression_type_name: Qualified<CustomTypeName>,
        field_name: FieldName,
        field_type: QualifiedTypeReference,
    },
    #[error(
        "the comparable field '{name}' is defined more than once in the boolean expression type '{type_name}'"
    )]
    DuplicateComparableFieldFound {
        type_name: Qualified<CustomTypeName>,
        name: FieldName,
    },
    #[error(
        "the comparable relationship '{name}' is defined more than once in the boolean expression type '{type_name}'"
    )]
    DuplicateComparableRelationshipFound {
        type_name: Qualified<CustomTypeName>,
        name: RelationshipName,
    },
    #[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 type of the comparable field '{field_name}' on the boolean expresssion '{boolean_expression_type_name}' is a multidimensional array type: {field_type}. Multidimensional arrays are not supported in boolean expressions"
    )]

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Remove the duplicate relationship entry with that `name`
  2. Rename one of the relationships if two distinct ones were intended
  3. Validate metadata files for duplicate keys before applying
Defensive patterns

Strategy: validation

Validate before calling

let mut seen = HashSet::new();
for r in &be_type.comparable_relationships {
    if !seen.insert(r.name.clone()) {
        return Err(format!("duplicate comparable relationship {}", r.name));
    }
}

Type guard

fn has_duplicate_relationships(rels: &[ComparableRelationship]) -> bool {
    let mut s = HashSet::new();
    rels.iter().any(|r| !s.insert(r.name.clone()))
}

Try / catch

if let BooleanExpressionIssue::DuplicateComparableRelationshipFound { type_name, name } = &issue {
    eprintln!("remove the duplicate relationship '{name}' in {type_name}");
}

Prevention

When it happens

Trigger: Listing the same relationship name twice among a boolean expression type's comparable relationships, typically via duplicated metadata blocks.

Common situations: Hand-edited HML where a relationship block was pasted twice; merging subgraph metadata that both define the same relationship name on the boolean expression type.

Related errors


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