{"record":{"id":"8d0c4aadf02fc263","repo":"hasura/graphql-engine","slug":"field-mapping-not-found-for-the-field-field-name-8d0c4a","errorCode":null,"errorMessage":"Field mapping not found for the field {field_name:} of type {type_name:} while executing the relationship {relationship_name:}","messagePattern":"Field mapping not found for the field (.+?) of type (.+?) while executing the relationship (.+?)","errorType":"error_code","errorClass":"RelationshipFieldMappingError","httpStatus":null,"severity":"error","filePath":"v3/crates/plan/src/query/relationships.rs","lineNumber":630,"sourceCode":"        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(\n    type_mappings: &BTreeMap<Qualified<CustomTypeName>, metadata_resolve::TypeMapping>,\n    type_name: &Qualified<CustomTypeName>,\n    relationship_name: &RelationshipName,\n    field_name: &FieldName,\n) -> Result<metadata_resolve::FieldMapping, RelationshipFieldMappingError> {\n    let type_mapping = type_mappings.get(type_name).ok_or_else(|| {\n        RelationshipFieldMappingError::TypeMappingNotFoundForRelationship {\n            type_name: type_name.clone(),","sourceCodeStart":612,"sourceCodeEnd":648,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/plan/src/query/relationships.rs#L612-L648","documentation":"RelationshipFieldMappingError::FieldMappingNotFoundForRelationship is thrown when resolving a relationship's join keys: a field referenced by the relationship mapping (field_name on type_name) has no entry in the type's field mappings. The relationship cannot be executed because the column mapping is incomplete.","triggerScenarios":"A relationship whose column_mapping references a field (e.g. author_id) that does not exist in the type mapping's field_mappings of the source or target type; typically after renaming a column or writing the mapping by hand.","commonSituations":"Column renames in the database not propagated to relationship metadata; manual JSON editing of relationships with typos; relationships created against an older schema version; computed fields used as join keys without mappings.","solutions":["Verify every field in the relationship's column mapping exists in the type's field_mappings","Fix typos or renamed fields in the relationship definition","Reload/refresh the source schema and recreate the relationship","If a join key is genuinely needed, add the corresponding field to the connector schema/type mapping"],"exampleFix":"// before\ncolumn_mapping: { \"authorId\": \"author_id\" }  // type maps field \"author_id\"\n// after\ncolumn_mapping: { \"author_id\": \"author_id\" }","handlingStrategy":"validation","validationCode":"for (src, tgt) in &rel.column_mapping {\n    assert!(source_fields.contains(src) && target_fields.contains(tgt),\n        \"join key {src}/{tgt} missing from field mappings\");\n}","typeGuard":null,"tryCatchPattern":"Catch FieldMappingNotFoundForRelationship and report the relationship name plus missing field for metadata repair.","preventionTips":["Regenerate relationship mappings after column renames","Validate column_mapping against both types' field sets in CI","Prefer foreign-key-derived relationships over manual mappings"],"tags":["rust","relationships","field-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"}