{"record":{"id":"55405c6a060e4d6b","repo":"hasura/graphql-engine","slug":"the-object-type-of-the-target-of-the-relationship","errorCode":null,"errorMessage":"the object type of the target of the relationship '{relationship_name}' ({relationship_target_object_type}) does not match the operand type of the boolean expression type '{boolean_expression_type}': '{boolean_expression_operand_type}'","messagePattern":"the object type of the target of the relationship '(.+?)' \\((.+?)\\) does not match the operand type of the boolean expression type '(.+?)': '(.+?)'","errorType":"validation","errorClass":"AggregateBooleanExpressionError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs","lineNumber":345,"sourceCode":"\n    #[error(\n        \"the comparable relationship '{relationship_name}' for the operand type '{operand_type}' references a boolean expression type that cannot be found: '{boolean_expression_type}'\"\n    )]\n    ComparableRelationshipBooleanExpressionNotFound {\n        operand_type: Qualified<CustomTypeName>,\n        relationship_name: open_dds::relationships::RelationshipName,\n        boolean_expression_type: Qualified<CustomTypeName>,\n    },\n\n    #[error(\n        \"the boolean expression type '{boolean_expression_type}' used in the comparable relationship '{relationship_name}' does not have an object aggregate operand\"\n    )]\n    ComparableRelationshipBooleanExpressionIncorrectOperandType {\n        relationship_name: open_dds::relationships::RelationshipName,\n        boolean_expression_type: Qualified<CustomTypeName>,\n    },\n\n    #[error(\n        \"the object type of the target of the relationship '{relationship_name}' ({relationship_target_object_type}) does not match the operand type of the boolean expression type '{boolean_expression_type}': '{boolean_expression_operand_type}'\"\n    )]\n    ComparableRelationshipBooleanExpressionTypeMismatch {\n        relationship_name: open_dds::relationships::RelationshipName,\n        relationship_target_object_type: Qualified<CustomTypeName>,\n        boolean_expression_type: Qualified<CustomTypeName>,\n        boolean_expression_operand_type: Qualified<CustomTypeName>,\n    },\n\n    #[error(\"the filter input model '{model_name}' cannot be found\")]\n    FilterInputModelNotFound { model_name: Qualified<ModelName> },\n\n    #[error(\n        \"the operand type '{operand_type}' does not match the type of the model '{model_name}': '{model_type}'\"\n    )]\n    FilterInputModelTypeMismatch {\n        operand_type: Qualified<CustomTypeName>,\n        model_name: Qualified<ModelName>,","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs#L327-L363","documentation":"For a comparable relationship, the resolver verified the boolean expression type has an object aggregate operand, but that operand's object type differs from the object type of the relationship's target. The relationship target and the boolean expression operand must denote the same object type so the generated comparison is well-typed.","triggerScenarios":"A comparable relationship with target_object_type B whose boolean_expression_type's object aggregate operand is typed C (C != B); e.g. relationship targets Article but the bool exp operand is typed Author.","commonSituations":"Renaming or swapping target types without updating the boolean expression type; copy-pasting a comparable relationship config and changing only the target; using a shared boolean expression type across multiple target types.","solutions":["Align the boolean expression type's object aggregate operand type with the relationship's target object type (the error prints both).","Or change the relationship's target_object_type to the operand type shown as boolean_expression_operand_type.","Regenerate/derive the boolean expression type from the intended target type so they cannot drift."],"exampleFix":"# before\n# relationship target: Article\nboolean_expression_type: AuthorBoolExp  # operand type: Author\n# after\n# relationship target: Article\nboolean_expression_type: ArticleBoolExp  # operand type: Article","handlingStrategy":"validation","validationCode":"for rel in &metadata.comparable_relationships {\n    let operand_type = object_aggregate_operand_type(&rel.boolean_expression_type);\n    if let Some(t) = operand_type {\n        assert_eq!(t, rel.target_object_type,\n            \"target {} does not match bool exp operand {}\", rel.target_object_type, t);\n    }\n}","typeGuard":null,"tryCatchPattern":"match resolve_metadata(docs) {\n    Err(e) => match e {\n        ResolveError::Stage(StageError::AggregateBooleanExpressions(\n            NamedAggregateBooleanExpressionIssue { issue, .. })) if matches!(issue,\n            AggregateBooleanExpressionIssue::ComparableRelationshipBooleanExpressionTypeMismatch { .. }) => {\n            // report both type names to guide the fix\n        }\n        other => return Err(other.into()),\n    },\n    Ok(resolved) => { /* ... */ }\n}","preventionTips":["Keep a single source of truth mapping object types to their boolean expression types.","When renaming a target type, grep for all boolean_expression_type references."],"tags":["metadata","type-mismatch","comparable-relationship","boolean-expression"],"backgroundTag":"metadata-validation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}