hasura/graphql-engine · error · RelationshipError
duplicate relationship field {field_name} from {relationship
Error message
duplicate relationship field {field_name} from {relationship_name} associated with source type {type_name} What it means
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.
Source
Thrown at v3/crates/metadata-resolve/src/stages/object_relationships/error.rs:15
use crate::stages::{commands, graphql_config, models};
use crate::types::subgraph::{Qualified, QualifiedTypeReference};
use graphql_types as ast;
use open_dds::{
arguments::ArgumentName,
commands::CommandName,
data_connector::DataConnectorName,
models::ModelName,
relationships::RelationshipName,
types::{CustomTypeName, FieldName},
};
#[derive(Debug, thiserror::Error)]
pub enum RelationshipError {
#[error(
"duplicate relationship field {field_name} from {relationship_name} associated with source type {type_name}"
)]
DuplicateRelationshipFieldInSourceType {
field_name: ast::Name,
type_name: Qualified<CustomTypeName>,
relationship_name: RelationshipName,
},
#[error(
"unknown target model {model_name:} used in relationship {relationship_name:} on type {type_name:}"
)]
UnknownTargetModelUsedInRelationship {
type_name: Qualified<CustomTypeName>,
relationship_name: RelationshipName,
model_name: Qualified<ModelName>,
},
#[error(View on GitHub (pinned to 724551b9ae)
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
Defensive patterns
Strategy: validation
Validate before calling
// ensure unique relationship field names per source type
let mut seen = HashSet::new();
for rel in &type.relationships {
assert!(seen.insert(rel.graphql_field_name()), "duplicate relationship field");
} Prevention
- Set explicit GraphQL field names for relationships
- Lint for name collisions after applying naming conventions
When it happens
Trigger: Two relationships on one source type whose configured/derived field names collide (e.g. both defaulting to the same field_name).
Common situations: Adding a second relationship without setting a distinct GraphQL field name; naming conventions collapsing distinct relationship names.
Related errors
- the model {model_name} has a duplicate root field in the Gra
- %s: %d %s
- %s: decoding graphql response errors: %w
- %s: %w
- %s: decoding graphql responnse data: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/9db22108ce1d2af3.
Report an issue: GitHub.