{"record":{"id":"c5c12504120b71c5","repo":"hasura/graphql-engine","slug":"no-support-for-using-the-same-type-type-name-ag","errorCode":null,"errorMessage":"No support for using the same type {type_name:} against multiple data connector objects {ndc_type_1:} and {ndc_type_2:}","messagePattern":"No support for using the same type (.+?) against multiple data connector objects (.+?) and (.+?)","errorType":"validation","errorClass":"TypeMappingCollectionError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/helpers/type_mappings.rs","lineNumber":27,"sourceCode":"use std::collections::BTreeMap;\n\n#[derive(Debug)]\npub struct TypeMappingToCollect<'a> {\n    pub type_name: &'a Qualified<CustomTypeName>,\n    pub ndc_object_type_name: &'a ndc_models::TypeName,\n}\n\n#[derive(thiserror::Error, Debug)]\npub enum TypeMappingCollectionError {\n    #[error(\n        \"No mapping defined for type {type_name:} to object {ndc_type_name:} of data connector {data_connector:}\"\n    )]\n    MappingNotDefined {\n        type_name: Qualified<CustomTypeName>,\n        data_connector: Qualified<DataConnectorName>,\n        ndc_type_name: DataConnectorObjectType,\n    },\n    #[error(\n        \"No support for using the same type {type_name:} against multiple data connector objects {ndc_type_1:} and {ndc_type_2:}\"\n    )]\n    MappingToMultipleDataConnectorObjectType {\n        type_name: Qualified<CustomTypeName>,\n        ndc_type_1: DataConnectorObjectType,\n        ndc_type_2: DataConnectorObjectType,\n    },\n    #[error(\n        \"Missing mapping for field {field_name:} when mapping type {type_name:} to object {ndc_type_name:} of data connector {data_connector:}\"\n    )]\n    MissingFieldMapping {\n        type_name: Qualified<CustomTypeName>,\n        field_name: FieldName,\n        data_connector: Qualified<DataConnectorName>,\n        ndc_type_name: DataConnectorObjectType,\n    },\n\n    #[error(\"Cannot return a predicate type from a command\")]","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/helpers/type_mappings.rs#L9-L45","documentation":"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.","triggerScenarios":"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.","commonSituations":"Copy-pasting mappings across subgraphs or connectors; refactoring that leaves stale mappings; merging metadata branches that both add mappings.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let mut seen: HashMap<Type, Object> = HashMap::new();\nassert!(!seen.insert(ty, obj).is_some()); // dedupe before resolve","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lint for duplicate type mappings across links/subgraphs in CI"],"tags":["type-mapping","duplicate-mapping","ndc"],"backgroundTag":"duplicate-type-mapping","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}