hasura/graphql-engine · error · ConflictingNameAcrossTypes
Types with conflicting name {name} found in {conflicting_sou
Error message
Types with conflicting name {name} found in {conflicting_sources} What it means
A metadata-resolve warning/error: the same type name was defined in more than one type source (e.g. both an ndc entity mapping and a local object type, or two different sources), so the resolver cannot unambiguously pick one. It lists the name and every conflicting source.
Source
Thrown at v3/crates/metadata-resolve/src/types/warning.rs:112
/// Indicates the type is a scalar type
#[display("ScalarType")]
Scalar,
/// Indicates the type is an object type
#[display("ObjectType")]
Object,
/// Indicates the type is a boolean expression type
#[display("BooleanExpressionType")]
BooleanExpression,
}
/// Represents a collection of conflicting type sources
#[derive(Debug, Display)]
#[display("{}", _0.into_iter().map(std::string::ToString::to_string).collect::<Vec<_>>().join(", "))]
pub struct ConflictingSources(pub nonempty::NonEmpty<TypeSource>);
/// Represents an error when a type name conflicts across different type sources
#[derive(Debug, thiserror::Error)]
#[error("Types with conflicting name {name} found in {conflicting_sources}")]
pub struct ConflictingNameAcrossTypes {
/// The name of the conflicting type
pub name: Qualified<CustomTypeName>,
/// The sources where the conflicting type was found
pub conflicting_sources: ConflictingSources,
}
View on GitHub (pinned to 724551b9ae)
Solutions
- Rename one of the conflicting types so each name maps to a single source
- Check the conflicting_sources list to see exactly which sources collide, then remove the duplicate definition
- If the collision is intended (override), use the mechanism your version provides for overriding rather than duplicating
Example fix
// before
// types.hml defines `object type User` while the entity mapping also exposes `User`
// after
object type AppUser { ... } // renamed locally to avoid the collision Defensive patterns
Strategy: validation
Validate before calling
// Detect duplicate names across sources before resolving
use std::collections::HashSet;
let mut seen = HashSet::new();
for src in all_type_sources {
for name in src.type_names() {
if !seen.insert(name.clone()) {
return Err(format!("duplicate type name: {name}"));
}
}
} Prevention
- Adopt a naming convention per source to avoid collisions
- Lint for locally defined types that shadow connector-mapped entities
When it happens
Trigger: Resolving metadata where a Qualified<CustomTypeName> is produced by multiple TypeSources simultaneously — for example a local object type in types.hml plus a type generated from an NDC entity/mapping or a relationship target with the same name.
Common situations: Defining an object type locally while the connector's entity mapping already exposes the same name; enabling a feature that auto-generates types that collide with hand-written ones; duplicating type definitions across files.
Related errors
- the relationship '{relationship_name}' is defined more than
- the boolean expression type with name {type_name} is defined
- the following command is defined more than once: {name:}
- the following argument in command {command_name:} is defined
- source for the following command is defined more than once:
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/ec50a6c8f8ef1f97.
Report an issue: GitHub.