{"record":{"id":"427ac8953722b0b9","repo":"hasura/graphql-engine","slug":"the-target-model-target-model-name-of-the-rela","errorCode":null,"errorMessage":"the target model '{target_model_name}' of the relationship '{relationship_name}' does not have a boolean expression type defined","messagePattern":"the target model '(.+?)' of the relationship '(.+?)' does not have a boolean expression type defined","errorType":"validation","errorClass":"BooleanExpressionIssue::ComparableRelationshipToModelWithoutBooleanExpressionType","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/boolean_expressions/types.rs","lineNumber":75,"sourceCode":"    },\n    #[error(\n        \"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.\"\n    )]\n    GraphqlFieldNameConflict {\n        type_name: Qualified<CustomTypeName>,\n        name: String,\n        name_source_1: FieldNameSource,\n        name_source_2: FieldNameSource,\n    },\n    #[error(\n        \"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\"\n    )]\n    MultidimensionalArrayComparableFieldNotSupported {\n        boolean_expression_type_name: Qualified<CustomTypeName>,\n        field_name: FieldName,\n        field_type: QualifiedTypeReference,\n    },\n    #[error(\n        \"the target model '{target_model_name}' of the relationship '{relationship_name}' does not have a boolean expression type defined\"\n    )]\n    ComparableRelationshipToModelWithoutBooleanExpressionType {\n        target_model_name: Qualified<ModelName>,\n        relationship_name: RelationshipName,\n    },\n    #[error(\"the boolean expression type with name {type_name} is defined more than once\")]\n    DuplicateBooleanExpressionType {\n        type_name: Qualified<CustomTypeName>,\n    },\n}\n\nimpl ContextualError for BooleanExpressionIssue {\n    fn create_error_context(&self) -> Option<error_context::Context> {\n        None\n    }\n}\n","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/boolean_expressions/types.rs#L57-L93","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nrelationships:\n  - name: author\n    targetModelName: authors\n    # authors has no BooleanExpressionType defined\n\n// after\nbooleanExpressionTypes:\n  - name: authors_bool_exp\n    objectType: authors\n# and reference authors_bool_exp on the authors model","handlingStrategy":"validation","validationCode":"// Before resolving, verify every comparable relationship's target model has a boolean expression type\nfn check_relationships(models: &BTreeMap<Qualified<ModelName>, Model>) -> Result<(), String> {\n    for model in models.values() {\n        for rel in model.relationships() {\n            if rel.is_comparable() {\n                let target = &rel.target_model_name;\n                if !boolean_expression_types.contains_key(target) {\n                    return Err(format!(\"target model {target} of relationship {} has no boolean expression type\", rel.name()));\n                }\n            }\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"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.","preventionTips":["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"],"tags":["hasura","metadata","boolean-expression","relationship","validation"],"backgroundTag":"metadata-schema-validation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}