{"record":{"id":"7ddb67fd4e0ad3d7","repo":"hasura/graphql-engine","slug":"type-mapping-not-found-for-the-type-name-type-nam-7ddb67","errorCode":null,"errorMessage":"Type mapping not found for the type name {type_name:} while executing the relationship {relationship_name:}","messagePattern":"Type mapping not found for the type name (.+?) while executing the relationship (.+?)","errorType":"error_code","errorClass":"RelationshipFieldMappingError","httpStatus":null,"severity":"error","filePath":"v3/crates/plan/src/query/relationships.rs","lineNumber":622,"sourceCode":"                Field::Column {\n                    column: ndc_column_name.clone(),\n                    fields: None,\n                    arguments: BTreeMap::new(),\n                },\n            );\n            SourceFieldAlias(internal_alias)\n        }\n        Some(field_alias) => SourceFieldAlias(field_alias.to_string()),\n    }\n}\n\nfn make_hasura_phantom_field(ndc_column_name: &DataConnectorColumnName) -> String {\n    format!(\"__hasura_phantom_field__{}\", ndc_column_name.as_str())\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum RelationshipFieldMappingError {\n    #[error(\n        \"Type mapping not found for the type name {type_name:} while executing the relationship {relationship_name:}\"\n    )]\n    TypeMappingNotFoundForRelationship {\n        type_name: Qualified<CustomTypeName>,\n        relationship_name: RelationshipName,\n    },\n\n    #[error(\n        \"Field mapping not found for the field {field_name:} of type {type_name:} while executing the relationship {relationship_name:}\"\n    )]\n    FieldMappingNotFoundForRelationship {\n        type_name: Qualified<CustomTypeName>,\n        relationship_name: RelationshipName,\n        field_name: FieldName,\n    },\n}\n\npub fn get_relationship_field_mapping_of_field_name(","sourceCodeStart":604,"sourceCodeEnd":640,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/plan/src/query/relationships.rs#L604-L640","documentation":"RelationshipFieldMappingError::TypeMappingNotFoundForRelationship occurs while planning a relationship join: the target (or source) type of the relationship has no type mapping in the data connector's schema, so the join columns cannot be resolved. It names both the missing type and the relationship being executed.","triggerScenarios":"Defining a relationship in metadata whose source or target model's type name has no type_mapping in the source's schema, then executing a query that traverses that relationship (nested selection).","commonSituations":"Renaming a model/type without updating relationship definitions; relationships between types in different data sources without proper source configuration; stale metadata after connector schema evolution; manually authored relationship mappings with wrong type names.","solutions":["Check the relationship's type names against type_mappings in the source's schema and correct mismatches","Reload the source metadata so type mappings refresh after schema changes","Recreate the relationship via the console/CLI so it references current type names","Ensure both sides of the relationship are tracked in the same source (or configured for cross-source)"],"exampleFix":"// before\nrelationship: { source_type: \"User\", target_type: \"Posts\" }  // mapping is \"Post\"\n// after\nrelationship: { source_type: \"User\", target_type: \"Post\" }","handlingStrategy":"validation","validationCode":"// Verify both endpoint types of a relationship are mapped before use\nfn relationship_types_mapped(rel: &Relationship, schema: &Schema) -> bool {\n    schema.type_mappings.contains_key(&rel.source_type) && schema.type_mappings.contains_key(&rel.target_type)\n}","typeGuard":null,"tryCatchPattern":"Catch TypeMappingNotFoundForRelationship during planning and flag the relationship in metadata as misconfigured rather than retrying.","preventionTips":["Create relationships via CLI/console instead of hand-editing JSON","Run consistency checks after renames","Test nested selections after every schema migration"],"tags":["rust","relationships","type-mapping","metadata","ndc"],"backgroundTag":"schema-validation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}