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

relationship '{relationship_name}' is used in comparableRela

Error message

relationship '{relationship_name}' is used in comparableRelationships in boolean expression type '{object_boolean_expression_type}' does not exist on type '{type_name}'

What it means

An object boolean expression type can declare comparableRelationships so relationship-based comparisons can be generated. This error occurs when a relationship listed there does not exist on the backing object type ('{type_name}'), so the resolver cannot build the relationship comparison expression.

Source

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

        data_connector: Qualified<DataConnectorName>,
        object_boolean_expression_type: Qualified<CustomTypeName>,
    },
    #[error(
        "unknown data connector object type {data_connector_object_type:} (in data connector {data_connector:}) referenced in object boolean expression type {object_boolean_expression_type:}"
    )]
    UnknownDataConnectorTypeInObjectBooleanExpressionType {
        data_connector: Qualified<DataConnectorName>,
        data_connector_object_type: DataConnectorObjectType,
        object_boolean_expression_type: Qualified<CustomTypeName>,
    },
    #[error(
        "unknown field '{field_name:}' used in object boolean expression type {object_boolean_expression_type:}"
    )]
    UnknownFieldInObjectBooleanExpressionType {
        field_name: FieldName,
        object_boolean_expression_type: Qualified<CustomTypeName>,
    },
    #[error(
        "relationship '{relationship_name}' is used in comparableRelationships in boolean expression type '{object_boolean_expression_type}' does not exist on type '{type_name}'"
    )]
    UnknownRelationshipInObjectBooleanExpressionType {
        relationship_name: RelationshipName,
        object_boolean_expression_type: Qualified<CustomTypeName>,
        type_name: Qualified<CustomTypeName>,
    },
    #[error(
        "the object type '{object_type:}' used in boolean expression type {object_boolean_expression_type:} does not have a mapping to object {data_connector_object_type:} of data connector {data_connector:}"
    )]
    NoDataConnectorTypeMappingForObjectTypeInBooleanExpression {
        object_type: Qualified<CustomTypeName>,
        object_boolean_expression_type: Qualified<CustomTypeName>,
        data_connector_object_type: DataConnectorObjectType,
        data_connector: Qualified<DataConnectorName>,
    },
    #[error("{error:} in boolean expression type {object_boolean_expression_type:}")]
    BooleanExpressionTypeMappingCollectionError {

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Check that the relationship in the error is defined on the exact backing object type named in the message
  2. Remove the entry from comparableRelationships if the relationship no longer exists
  3. Fix typos or move the relationship definition onto the correct type
  4. Rebuild metadata
Defensive patterns

Strategy: validation

Validate before calling

// Every comparableRelationship must exist on the backing object type
let rels: HashSet<&str> = object_type.relationships().map(|r| r.name()).collect();
for r in boolean_expr.comparable_relationships() {
    if !rels.contains(r.as_str()) {
        return Err(format!("relationship {r} not defined on backing type"));
    }
}

Try / catch

match resolve(metadata) {
    Err(BooleanExpressionError::UnknownRelationshipInObjectBooleanExpressionType { relationship_name, type_name, .. }) => {
        // add the relationship to the type or drop it from comparableRelationships
    }
    other => other,
}

Prevention

When it happens

Trigger: Listing a relationship name under comparableRelationships that is not defined on the backing object type; deleting or renaming a relationship but leaving it in the boolean expression's comparableRelationships list.

Common situations: Relationship refactors (rename/move) without updating filter configuration; defining the relationship on a different type than the one backing the boolean expression; typos in relationship names.

Related errors


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