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

the comparable field '{name}' is defined more than once in t

Error message

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

What it means

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

Source

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

    #[error(
        "The data connector '{data_connector_name}' does not support filtering by nested object arrays. The comparable field '{field_name}' within {boolean_expression_type_name}' is of an object array type: {field_type}"
    )]
    DataConnectorDoesNotSupportNestedObjectArrayFiltering {
        data_connector_name: Qualified<DataConnectorName>,
        boolean_expression_type_name: Qualified<CustomTypeName>,
        field_name: FieldName,
        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>,

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Find and remove the duplicate comparable field entry with that `name` in the boolean expression type
  2. If two distinct underlying columns need filtering, give them different field names
  3. Lint metadata with a YAML duplicate-key checker before applying

Example fix

// before
boolean_expression_type: AuthorFilter
comparable_fields:
  - name: title
  - name: title
// after
boolean_expression_type: AuthorFilter
comparable_fields:
  - name: title
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

fn has_duplicate_fields(fields: &[ComparableField]) -> bool {
    let mut s = HashSet::new();
    fields.iter().any(|f| !s.insert(f.name.clone()))
}

Try / catch

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

Prevention

When it happens

Trigger: Metadata (often generated or hand-edited) listing the same field name twice among the boolean expression type's comparable fields, e.g. duplicate entries after merging HML files or copy-paste.

Common situations: Copy-pasting field blocks in HML; duplicate keys surviving YAML/JSON merge; generated metadata emitting the same field for multiple underlying columns with one field name.

Related errors


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