hasura/graphql-engine · error · TypeMappingCollectionError
No support for using the same type {type_name:} against mult
Error message
No support for using the same type {type_name:} against multiple data connector objects {ndc_type_1:} and {ndc_type_2:} What it means
The same custom type is mapped to two different NDC object types, which is unsupported. Type mapping collection enforces one-to-one mapping between a custom type and a data connector object type.
Source
Thrown at v3/crates/metadata-resolve/src/helpers/type_mappings.rs:27
use std::collections::BTreeMap;
#[derive(Debug)]
pub struct TypeMappingToCollect<'a> {
pub type_name: &'a Qualified<CustomTypeName>,
pub ndc_object_type_name: &'a ndc_models::TypeName,
}
#[derive(thiserror::Error, Debug)]
pub enum TypeMappingCollectionError {
#[error(
"No mapping defined for type {type_name:} to object {ndc_type_name:} of data connector {data_connector:}"
)]
MappingNotDefined {
type_name: Qualified<CustomTypeName>,
data_connector: Qualified<DataConnectorName>,
ndc_type_name: DataConnectorObjectType,
},
#[error(
"No support for using the same type {type_name:} against multiple data connector objects {ndc_type_1:} and {ndc_type_2:}"
)]
MappingToMultipleDataConnectorObjectType {
type_name: Qualified<CustomTypeName>,
ndc_type_1: DataConnectorObjectType,
ndc_type_2: DataConnectorObjectType,
},
#[error(
"Missing mapping for field {field_name:} when mapping type {type_name:} to object {ndc_type_name:} of data connector {data_connector:}"
)]
MissingFieldMapping {
type_name: Qualified<CustomTypeName>,
field_name: FieldName,
data_connector: Qualified<DataConnectorName>,
ndc_type_name: DataConnectorObjectType,
},
#[error("Cannot return a predicate type from a command")]View on GitHub (pinned to 724551b9ae)
Solutions
- Remove or consolidate duplicate mappings so the type maps to exactly one NDC object type
- If two shapes are genuinely needed, create two distinct custom types and map each separately
- Audit all typeMappings blocks referencing the type
Defensive patterns
Strategy: validation
Validate before calling
let mut seen: HashMap<Type, Object> = HashMap::new(); assert!(!seen.insert(ty, obj).is_some()); // dedupe before resolve
Prevention
- Lint for duplicate type mappings across links/subgraphs in CI
When it happens
Trigger: Defining mappings for type T to object A on one model/link and to object B on another; duplicate mapping entries with different ndc object type names.
Common situations: Copy-pasting mappings across subgraphs or connectors; refactoring that leaves stale mappings; merging metadata branches that both add mappings.
Related errors
- the type {unknown_ndc_type:} is not defined as an object typ
- mapping for type {type_name} of model {model_name} is not de
- mapping for type {type_name} of command {command_name} is no
- No mapping defined for type {type_name:} to object {ndc_type
- Missing mapping for field {field_name:} when mapping type {t
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/c5c12504120b71c5.
Report an issue: GitHub.