{"record":{"id":"9db22108ce1d2af3","repo":"hasura/graphql-engine","slug":"duplicate-relationship-field-field-name-from-re","errorCode":null,"errorMessage":"duplicate relationship field {field_name} from {relationship_name} associated with source type {type_name}","messagePattern":"duplicate relationship field (.+?) from (.+?) associated with source type (.+?)","errorType":"validation","errorClass":"RelationshipError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/object_relationships/error.rs","lineNumber":15,"sourceCode":"use crate::stages::{commands, graphql_config, models};\nuse crate::types::subgraph::{Qualified, QualifiedTypeReference};\nuse graphql_types as ast;\nuse open_dds::{\n    arguments::ArgumentName,\n    commands::CommandName,\n    data_connector::DataConnectorName,\n    models::ModelName,\n    relationships::RelationshipName,\n    types::{CustomTypeName, FieldName},\n};\n\n#[derive(Debug, thiserror::Error)]\npub enum RelationshipError {\n    #[error(\n        \"duplicate relationship field {field_name} from {relationship_name} associated with source type {type_name}\"\n    )]\n    DuplicateRelationshipFieldInSourceType {\n        field_name: ast::Name,\n        type_name: Qualified<CustomTypeName>,\n        relationship_name: RelationshipName,\n    },\n\n    #[error(\n        \"unknown target model {model_name:} used in relationship {relationship_name:} on type {type_name:}\"\n    )]\n    UnknownTargetModelUsedInRelationship {\n        type_name: Qualified<CustomTypeName>,\n        relationship_name: RelationshipName,\n        model_name: Qualified<ModelName>,\n    },\n\n    #[error(","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/object_relationships/error.rs#L1-L33","documentation":"While resolving object-type relationships, two relationships on the same source custom type would generate the same GraphQL relationship field name, causing a duplicate field on the source type.","triggerScenarios":"Two relationships on one source type whose configured/derived field names collide (e.g. both defaulting to the same field_name).","commonSituations":"Adding a second relationship without setting a distinct GraphQL field name; naming conventions collapsing distinct relationship names.","solutions":["Rename one relationship's GraphQL field name in the relationship metadata","Adjust global naming conventions so the two fields differ","Remove the duplicate relationship if it was accidental"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// ensure unique relationship field names per source type\nlet mut seen = HashSet::new();\nfor rel in &type.relationships {\n    assert!(seen.insert(rel.graphql_field_name()), \"duplicate relationship field\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set explicit GraphQL field names for relationships","Lint for name collisions after applying naming conventions"],"tags":["hasura","relationships","graphql","duplicate-field"],"backgroundTag":"graphql-name-collision","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}