hasura/graphql-engine · error · BooleanExpressionIssue::ComparableRelationshipToModelWithoutBooleanExpressionType
the target model '{target_model_name}' of the relationship '
Error message
the target model '{target_model_name}' of the relationship '{relationship_name}' does not have a boolean expression type defined What it means
Thrown by the metadata-resolve boolean expressions stage when a comparable relationship points at a target model that has no boolean expression type defined. When generating filter/input types for boolean expressions, relationships to comparable models must resolve to the target model's boolean expression type; if the target model lacks one, resolution fails. It is a metadata configuration error surfaced during schema resolution.
Source
Thrown at v3/crates/metadata-resolve/src/stages/boolean_expressions/types.rs:75
},
#[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>,
},
}
impl ContextualError for BooleanExpressionIssue {
fn create_error_context(&self) -> Option<error_context::Context> {
None
}
}
View on GitHub (pinned to 724551b9ae)
Solutions
- Add/define a boolean expression type (e.g. a BooleanExpressionType input) for the target model named in the error
- Or remove the relationship from the source model's boolean expression type so it is not treated as comparable
- Verify the relationship's target model name is spelled correctly and resolves to the intended model
- If the target model should not be filterable, mark the relationship as non-comparable instead of comparable
Example fix
// before
relationships:
- name: author
targetModelName: authors
# authors has no BooleanExpressionType defined
// after
booleanExpressionTypes:
- name: authors_bool_exp
objectType: authors
# and reference authors_bool_exp on the authors model Defensive patterns
Strategy: validation
Validate before calling
// Before resolving, verify every comparable relationship's target model has a boolean expression type
fn check_relationships(models: &BTreeMap<Qualified<ModelName>, Model>) -> Result<(), String> {
for model in models.values() {
for rel in model.relationships() {
if rel.is_comparable() {
let target = &rel.target_model_name;
if !boolean_expression_types.contains_key(target) {
return Err(format!("target model {target} of relationship {} has no boolean expression type", rel.name()));
}
}
}
}
Ok(())
} Try / catch
Catch the resolve error and match on BooleanExpressionIssue::ComparableRelationshipToModelWithoutBooleanExpressionType to extract relationship_name/target_model_name and point the user at the offending relationship in their metadata.
Prevention
- Define boolean expression types for every model referenced by comparable relationships
- Lint metadata for relationships whose target model lacks a boolean expression type before resolve
- Keep relationship comparability flags accurate instead of defaulting everything to comparable
When it happens
Trigger: Defining a relationship on a model whose boolean expression type includes relationship expressions, where the related target model has no boolean expression type configured (e.g. it lacks a comparable/comparable_exp input type in its BooleanExpressionType). Resolving metadata with such a relationship triggers ComparableRelationshipToModelWithoutBooleanExpressionType.
Common situations: Adding a relationship field into a model's boolean expression filter while the target model was not given a boolean expression type (e.g. missing name-based BooleanExpressionType for the target model, or the target model was deliberately excluded from boolean expression generation). Often appears after upgrading to a version that validates relationship expressions more strictly.
Related errors
- relationship '{relationship_name}' is used in predicate but
- error fetching config from server: %w
- error fetching server config: %v
- could not find a scalar-operanded boolean expression type na
- the type of the comparable field '{field_name}' ({field_type
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/427ac8953722b0b9.
Report an issue: GitHub.