{"record":{"id":"eeb9420a5e45a0af","repo":"hasura/graphql-engine","slug":"target-model-model-name-not-found-referenced-i","errorCode":null,"errorMessage":"Target model {model_name:} not found, referenced in relationship {relationship_name:}","messagePattern":"Target model (.+?) not found, referenced in relationship (.+?)","errorType":"validation","errorClass":"BooleanExpressionError::TargetModelNotFound","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/boolean_expressions/error.rs","lineNumber":163,"sourceCode":"    DataConnectorScalarRepresentationsNotFound {\n        data_connector_name: Qualified<DataConnectorName>,\n        boolean_expression_type: Qualified<CustomTypeName>,\n    },\n\n    #[error(\n        \"Field level comparison operator configuration is not fully supported yet. Please use \\\"enableAll\\\":true.\"\n    )]\n    FieldLevelComparisonOperatorConfigurationNotSupported,\n\n    #[error(\n        \"Field level comparison operator configuration is not fully supported yet. Please add all fields in filterable_fields.\"\n    )]\n    FieldLevelComparisonOperatorNeedsAllFields,\n\n    #[error(\"a source must be defined for model {model:} in order to use filter expressions\")]\n    CannotUseFilterExpressionsWithoutSource { model: Qualified<ModelName> },\n\n    #[error(\n        \"Target model {model_name:} not found, referenced in relationship {relationship_name:}\"\n    )]\n    TargetModelNotFound {\n        relationship_name: RelationshipName,\n        model_name: Qualified<ModelName>,\n    },\n\n    #[error(\n        \"Model {model:} has source data connector {model_data_connector:} but its filter expression type {filter_expression_type:} is backed by data connector {filter_expression_data_connector:}\"\n    )]\n    DifferentDataConnectorInFilterExpression {\n        model: Qualified<ModelName>,\n        model_data_connector: Qualified<DataConnectorName>,\n        filter_expression_type: Qualified<CustomTypeName>,\n        filter_expression_data_connector: Qualified<DataConnectorName>,\n    },\n    #[error(\n        \"Model {model:} has source data connector object type {model_data_connector_object_type:} but its filter expression type {filter_expression_type:} is backed by data connector {filter_expression_data_connector_object_type:}\"","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/boolean_expressions/error.rs#L145-L181","documentation":"A relationship references a target model that does not exist in the resolved metadata. Relationship resolution happens during boolean expression type resolution, and the target model lookup fails.","triggerScenarios":"Declaring a relationship whose targetModelName refers to a model that is not defined (or not yet resolved) in the metadata; typo in the target model name; different subgraph/namespace qualification.","commonSituations":"Renaming or deleting a model without updating relationships pointing at it; cross-namespace reference missing the fully qualified name; a model in another OpenDDs directory not included in the build.","solutions":["Fix the target model name in the relationship to the exact Qualified<ModelName> (including namespace)","Create the missing target model if it should exist","Ensure the directory containing the target model's metadata is included in the metadata sources"],"exampleFix":"// before\nrelationships:\n  albums:\n    targetModel: Album\n// after\nrelationships:\n  albums:\n    targetModel:\n      name: Album\n      subgraph: music","handlingStrategy":"validation","validationCode":"const modelNames = new Set(models.map(m => qualifiedName(m)));\nfor (const rel of relationships) {\n  if (!modelNames.has(qualifiedName(rel.targetModel))) {\n    fail(`relationship ${rel.name} targets unknown model ${rel.targetModel}`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always fully qualify target model names (name + subgraph)","When renaming/deleting a model, grep relationships for references","Keep all related metadata in the same build so resolution sees the target"],"tags":["hasura","relationship","model-not-found","metadata"],"backgroundTag":"missing-model-reference","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}