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

the type of the comparable field

Error message

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

What it means

A comparable field's type resolves to a multidimensional array (array of arrays). Multidimensional arrays cannot be expressed in boolean expression filters, so resolution fails outright.

Solutions

  1. Remove the multidimensional field from comparable fields
  2. Change the field's type to a flat scalar array or JSON if the shape is not semantically 2D
  3. If the underlying column is genuinely 2D, expose it via a non-comparable field only

Example fix

// before
matrix: [[Float]]
  comparable: true
// after
matrix: [[Float]]
  comparable: false
Defensive patterns

Strategy: validation

Validate before calling

fn array_depth(mut t: &QualifiedType) -> usize {
    let mut d = 0;
    while let QualifiedType::Array(inner) = t { d += 1; t = inner; }
    d
}
for f in &be_type.comparable_fields {
    assert!(array_depth(&f.field_type.underlying) < 2,
        "{} is multidimensional; not allowed in boolean expressions", f.name);
}

Type guard

fn is_multidimensional(t: &QualifiedTypeReference) -> bool {
    matches!(t.underlying(), QualifiedType::Array(inner)
        if matches!(**inner, QualifiedType::Array(_)))
}

Try / catch

if let BooleanExpressionIssue::MultidimensionalArrayComparableFieldNotSupported { field_name, field_type, .. } = &issue {
    log::error!("{field_name} ({field_type}) is multidimensional; mark it non-comparable");
}

Prevention

When it happens

Trigger: Declaring a comparable field whose QualifiedTypeReference is a nested array type, e.g. `[[Int]]`, in a boolean expression type.

Common situations: Postgres columns typed as multi-dimensional arrays or nested JSON arrays mapped to nested array types in metadata; schema changes introducing `[][]` types into a type with an existing boolean expression.

Related errors


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

Appendix: source

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

        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"
    )]
    MultidimensionalArrayComparableFieldNotSupported {
        boolean_expression_type_name: Qualified<CustomTypeName>,
        field_name: FieldName,
        field_type: QualifiedTypeReference,
    },
    #[error(
        "the target model '{target_model_name}' of the relationship '{relationship_name}' does not have a boolean expression type defined"
    )]
    ComparableRelationshipToModelWithoutBooleanExpressionType {
        target_model_name: Qualified<ModelName>,
        relationship_name: RelationshipName,
    },
    #[error("the boolean expression type with name {type_name} is defined more than once")]
    DuplicateBooleanExpressionType {
        type_name: Qualified<CustomTypeName>,
    },

View on GitHub (pinned to 724551b9ae)