{"record":{"id":"fb27a6ad59879a98","repo":"hasura/graphql-engine","slug":"the-comparable-relationship-relationship-name","errorCode":null,"errorMessage":"the comparable relationship '{relationship_name}' was not found for the operand type '{operand_type}'","messagePattern":"the comparable relationship '(.+?)' was not found for the operand type '(.+?)'","errorType":"validation","errorClass":"AggregateBooleanExpressionError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs","lineNumber":295,"sourceCode":"\n    #[error(\n        \"the type of the comparable field '{field_name}' ({field_type}) does not match the operand type of the boolean expression type '{boolean_expression_type}': '{boolean_expression_operand_type}'\"\n    )]\n    ComparableFieldBooleanExpressionTypeMismatch {\n        field_name: FieldName,\n        field_type: QualifiedTypeName,\n        boolean_expression_type: Qualified<CustomTypeName>,\n        boolean_expression_operand_type: QualifiedTypeName,\n    },\n\n    #[error(\n        \"the relationship '{relationship_name}' is defined more than once in the comparable relationships\"\n    )]\n    DuplicateComparableRelationshipsFound {\n        relationship_name: open_dds::relationships::RelationshipName,\n    },\n\n    #[error(\n        \"the comparable relationship '{relationship_name}' was not found for the operand type '{operand_type}'\"\n    )]\n    ComparableRelationshipNotFound {\n        operand_type: Qualified<CustomTypeName>,\n        relationship_name: RelationshipName,\n    },\n\n    #[error(\n        \"the comparable relationship '{relationship_name}' for the operand type '{operand_type}' targets a command. This is not supported\"\n    )]\n    ComparableRelationshipCommandTargetNotSupported {\n        operand_type: Qualified<CustomTypeName>,\n        relationship_name: RelationshipName,\n    },\n\n    #[error(\n        \"the comparable relationship '{relationship_name}' for the operand type '{operand_type}' is an array relationship. This is not supported\"\n    )]","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs#L277-L313","documentation":"A comparable relationship references a relationship by name on a given operand type, but no relationship with that name exists on that type. The resolver looks up the relationship on the operand's type and fails, since aggregation over it cannot be built.","triggerScenarios":"The comparableRelationships list names a relationship that is not defined on the boolean expression type's operand type (typos, renames, or referencing a relationship defined on a different type).","commonSituations":"Renaming a relationship in relationships.yaml without updating the comparable relationships list; misspelling the relationship name; referencing a relationship that belongs to another model/type in the same subgraph.","solutions":["Check the exact relationship name on the operand type and correct the comparableRelationships entry","Define the missing relationship on the operand type if it was intended","After renaming relationships, update all comparable relationship references"],"exampleFix":"# before\n# type Author has relationship 'writtenArticles'\ncomparableRelationships:\n  - relationshipName: articles   # wrong name\n\n# after\ncomparableRelationships:\n  - relationshipName: writtenArticles","handlingStrategy":"validation","validationCode":"for r in &comparable_relationships {\n    assert!(operand_type.relationships.contains_key(&r.relationship_name),\n        \"relationship {} not defined on operand type\", r.relationship_name);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Single-source relationship names (reference the relationships file) instead of duplicating strings","Update comparableRelationships whenever relationships are renamed"],"tags":["rust","hasura","metadata","relationship-not-found"],"backgroundTag":"relationship-not-found-in-metadata","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}