hasura/graphql-engine · error · BooleanExpressionError::FieldTypeMismatch

The field {field_name:} has type {field_type:} but the field

Error message

The field {field_name:} has type {field_type:} but the field's boolean expression type {field_boolean_expression_type_name:} has type {underlying_type:}

What it means

Thrown while resolving a model's boolean expression (filter input) type: the type of a field on the boolean expression type does not match the type of the underlying model field it filters. The metadata declares a boolean_expression_type whose field maps to a model field with a different type, so the generated filter expression would be unsound.

Source

Thrown at v3/crates/metadata-resolve/src/stages/boolean_expressions/error.rs:132

    #[error(
        "The data connector '{data_connector_name}' does not support filtering inside nested objects. The comparable field '{field_name}' within '{boolean_expression_type_name}' is of a nested object type: {field_type}"
    )]
    DataConnectorDoesNotSupportNestedObjectFiltering {
        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 across nested relationships. The nested object field '{field_name}' within '{parent_boolean_expression_type_name}' references the boolean expression type '{nested_boolean_expression_type_name}' which has relationship comparisons, making them nested relationship comparisons."
    )]
    DataConnectorDoesNotSupportNestedRelationshipFiltering {
        data_connector_name: Qualified<DataConnectorName>,
        field_name: FieldName,
        parent_boolean_expression_type_name: Qualified<CustomTypeName>,
        nested_boolean_expression_type_name: Qualified<CustomTypeName>,
    },
    #[error(
        "The field {field_name:} has type {field_type:} but the field's boolean expression type {field_boolean_expression_type_name:} has type {underlying_type:}"
    )]
    FieldTypeMismatch {
        field_name: FieldName,
        field_type: QualifiedTypeName,
        field_boolean_expression_type_name: BooleanExpressionTypeIdentifier,
        underlying_type: QualifiedTypeName,
    },

    #[error(
        "Scalar representations for data connector '{data_connector_name}' could not found for boolean expression type {boolean_expression_type}"
    )]
    DataConnectorScalarRepresentationsNotFound {
        data_connector_name: Qualified<DataConnectorName>,
        boolean_expression_type: Qualified<CustomTypeName>,
    },

    #[error(

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Compare each field in the boolean expression object type with the matching field on the model and align their types exactly
  2. If the model field type changed, update the boolean_expression_type field to the new type
  3. Regenerate or re-derive the boolean expression type from the model instead of maintaining it by hand

Example fix

// before (model field is Float, expression declares Int)
booleanExpressionType:
  fields:
    rating: Int!
// after
booleanExpressionType:
  fields:
    rating: Float!
Defensive patterns

Strategy: validation

Validate before calling

// before applying metadata, assert each boolean expression field type matches the model field type
function assertFieldTypeMatches(model, boolExpType) {
  for (const f of Object.values(boolExpType.fields)) {
    const m = model.fields[f.name];
    if (!m) throw new Error(`unknown model field ${f.name}`);
    if (String(m.type) !== String(f.type)) {
      throw new Error(`type mismatch on ${f.name}: model=${m.type} expr=${f.type}`);
    }
  }
}

Prevention

When it happens

Trigger: Defining an open-dds boolean_expressionType for a model where a field in the expression object type has a different type than the corresponding field on the target model; e.g. the model field is Float but the expression type declares it as Int, or a renamed/mismatched type after a metadata refactor.

Common situations: Hand-written OpenDDs YAML where the filter object type drifts from the model type; changing a model field's type without updating the corresponding boolean expression type; copying a boolean expression type from another model.

Related errors


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