{"record":{"id":"d891a2af93856fc5","repo":"hasura/graphql-engine","slug":"relationship-relationship-name-is-used-in-pred-d891a2","errorCode":null,"errorMessage":"relationship '{relationship_name}' is used in predicate but does not exist in comparableRelationships in boolean expression '{boolean_expression_type_name}'","messagePattern":"relationship '(.+?)' is used in predicate but does not exist in comparableRelationships in boolean expression '(.+?)'","errorType":"validation","errorClass":"TypePredicateError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/types/error.rs","lineNumber":489,"sourceCode":"    #[error(\"Nested predicate used in type '{type_name:}'\")]\n    NestedPredicateInTypePredicate {\n        type_name: Qualified<CustomTypeName>,\n    },\n    #[error(\n        \"no boolean expression found for type '{type_name:}' This is required when filtering a nested field. Please ensure the model you are filtering has a filterExpressionType defined.\"\n    )]\n    NoBooleanExpressionFields {\n        field_name: Spanned<FieldName>,\n        type_name: Qualified<CustomTypeName>,\n    },\n    #[error(\n        \"relationship '{relationship_name}' is used in predicate but does not exist for type '{type_name}'\"\n    )]\n    UnknownRelationshipInTypePredicate {\n        relationship_name: Spanned<RelationshipName>,\n        type_name: Qualified<CustomTypeName>,\n    },\n    #[error(\n        \"relationship '{relationship_name}' is used in predicate but does not exist in comparableRelationships in boolean expression '{boolean_expression_type_name}'\"\n    )]\n    RelationshipNotComparableInTypePredicate {\n        relationship_name: Spanned<RelationshipName>,\n        boolean_expression_type_name: Qualified<CustomTypeName>,\n    },\n    #[error(\n        \"The model '{target_model_name:}' corresponding to the  relationship '{relationship_name:}' used in predicate for type '{type_name:}' is not defined\"\n    )]\n    UnknownModelUsedInRelationshipTypePredicate {\n        type_name: Qualified<CustomTypeName>,\n        target_model_name: Qualified<ModelName>,\n        relationship_name: RelationshipName,\n    },\n    #[error(\n        \"target source for model '{target_model_name:}' is required to resolve predicate with relationships for {source_type_name:}\"\n    )]\n    TargetSourceRequiredForRelationshipPredicate {","sourceCodeStart":471,"sourceCodeEnd":507,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/types/error.rs#L471-L507","documentation":"A predicate used a relationship for filtering, but that relationship is not listed in the boolean expression type's `comparableRelationships`. Only relationships explicitly marked comparable by the boolean expression type can be used inside predicates of that expression.","triggerScenarios":"Adding a relationship to a model and filtering on it while the model's custom `filterExpressionType` doesn't include it in `comparableRelationships`; custom boolean expression types authored before the relationship existed.","commonSituations":"Custom filterExpressionType drifted out of sync with new relationships; team adds relationships but no one updates the expression type; migrating from default to custom expression types that omit comparableRelationships.","solutions":["Open the boolean expression type named by `boolean_expression_type_name` and add the relationship to its `comparableRelationships` list","Verify the relationship name is spelled identically to the model's relationship declaration","Alternatively stop filtering via that relationship, or drop the custom expression type to use the generated default"],"exampleFix":"# before\ntypes:\n  UserBoolExpr:\n    comparableRelationships: []\n# after\ntypes:\n  UserBoolExpr:\n    comparableRelationships: [articles]\n","handlingStrategy":"validation","validationCode":"// Check the relationship is comparable per the expression type before filtering\nif !bool_expr_type.comparable_relationships.contains(&relationship_name) {\n    return Err(\"relationship not comparable in this boolean expression\".into());\n}","typeGuard":"fn is_comparable(e: &BooleanExpressionType, r: &RelationshipName) -> bool {\n    e.comparable_relationships.contains(r)\n}","tryCatchPattern":"if let Err(TypePredicateError::RelationshipNotComparableInTypePredicate { relationship_name, boolean_expression_type_name }) = result {\n    // add relationship to comparableRelationships or filter differently\n}","preventionTips":["When adding relationships, update comparableRelationships on custom expression types in the same change","Prefer default generated expression types unless you need restrictions"],"tags":["relationship","boolean-expression","filter","metadata","hasura"],"backgroundTag":"relationship-not-filterable","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}