hasura/graphql-engine · error · TypePredicateError::TypeMappingCollectionError
{error:} in type {type_name:}
Error message
{error:} in type {type_name:} What it means
Wrapper error attaching the type name to a TypeMappingCollectionError raised while collecting the type mappings for that type. The inner `error` (a TypeMappingCollectionError) describes the concrete problem — e.g. duplicate or conflicting type mappings — and this variant tells you which type it happened on.
Source
Thrown at v3/crates/metadata-resolve/src/types/error.rs:511
relationship_name: Spanned<RelationshipName>,
boolean_expression_type_name: Qualified<CustomTypeName>,
},
#[error(
"The model '{target_model_name:}' corresponding to the relationship '{relationship_name:}' used in predicate for type '{type_name:}' is not defined"
)]
UnknownModelUsedInRelationshipTypePredicate {
type_name: Qualified<CustomTypeName>,
target_model_name: Qualified<ModelName>,
relationship_name: RelationshipName,
},
#[error(
"target source for model '{target_model_name:}' is required to resolve predicate with relationships for {source_type_name:}"
)]
TargetSourceRequiredForRelationshipPredicate {
source_type_name: Qualified<CustomTypeName>,
target_model_name: Qualified<ModelName>,
},
#[error("{error:} in type {type_name:}")]
TypeMappingCollectionError {
type_name: Qualified<CustomTypeName>,
error: TypeMappingCollectionError,
},
#[error("expected object type for field {field_name:} but field had type {field_type:}")]
ExpectedObjectType {
field_type: QualifiedTypeReference,
field_name: Spanned<FieldName>,
},
#[error("object type {type_name:} not found")]
ObjectTypeNotFound {
type_name: Qualified<CustomTypeName>,
},
#[error("operator mappings not found for data connector {data_connector_name:}")]
OperatorMappingsNotFound {
data_connector_name: Qualified<DataConnectorName>,
},
#[error("no type mapping found for type {type_name:} in data connector {data_connector_name:}")]View on GitHub (pinned to 724551b9ae)
Solutions
- Read the inner `{error}` message — it carries the specific TypeMappingCollectionError (e.g. duplicate mapping details)
- Fix the reported mapping conflict on `type_name` (remove the duplicate or reconcile the two representations)
- Re-run metadata resolve to confirm the collection step now succeeds
- Add CI metadata validation to catch mapping conflicts before deploy
Example fix
# before: same underlying type mapped twice with different representations
# TypeMappingCollectionError: duplicate mapping ...
# after: keep a single consistent representation
fields:
a: {type: string, mapping: {column: a}}
b: {type: string, mapping: {column: b}}
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-flight: detect duplicate/conflicting type mappings before resolution
let mut seen = HashSet::new();
for m in collect_mappings(&type_mappings) {
if !seen.insert(m.type_name.clone()) {
return Err(format!("duplicate mapping for {}", m.type_name));
}
}
Ok(()) Try / catch
if let Err(TypePredicateError::TypeMappingCollectionError { type_name, error }) = result {
return Err(format!("mapping error on {type_name}: {error}"));
} Prevention
- Keep one canonical representation per underlying type
- Run metadata validation after merging metadata from multiple sources
When it happens
Trigger: A type's mapping collection (the per-type aggregation of field type mappings into the NDC schema) fails — commonly duplicate type mappings for the same type, or conflicting representations collected while building the type's schema.
Common situations: Two fields mapping to the same underlying type with different representations; copy-pasted type mappings creating duplicates; connector schema generation hitting inconsistent mappings after metadata merges.
Related errors
- the type {unknown_ndc_type:} is not defined as an object typ
- field '{field_name}' of type '{type_name}' used in a field c
- metadata is not consistent: {error}
- An issue occurred while mapping arguments in the model {mode
- the type {unknown_ndc_field_type_name:} is not defined as an
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/8a4ded73e8d0f91a.
Report an issue: GitHub.