{"record":{"id":"91af4b8a04294a4d","repo":"hasura/graphql-engine","slug":"found-multiple-models-model-1-model-2-that","errorCode":null,"errorMessage":"Found multiple models  {model_1:}, {model_2:} that implement the same object type {object_type:} to be global ID sources.","messagePattern":"Found multiple models  (.+?), (.+?) that implement the same object type (.+?) to be global ID sources\\.","errorType":"validation","errorClass":"RelayError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/relay/mod.rs","lineNumber":39,"sourceCode":"    Ok(())\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum RelayError {\n    #[error(\n        \"'globalIdFields' for type {object_type:} found, but no model found with 'globalIdSource: true' for type {object_type:}\"\n    )]\n    GlobalIdSourceNotDefined {\n        object_type: Qualified<CustomTypeName>,\n    },\n    #[error(\n        \"Model {model_name:} is marked as a global ID source but there are no global id fields present in the related object type {type_name:}\"\n    )]\n    NoGlobalFieldsPresentInGlobalIdSource {\n        type_name: Qualified<CustomTypeName>,\n        model_name: ModelName,\n    },\n    #[error(\n        \"Found multiple models  {model_1:}, {model_2:} that implement the same object type {object_type:} to be global ID sources.\"\n    )]\n    DuplicateModelGlobalIdSource {\n        model_1: Qualified<ModelName>,\n        model_2: Qualified<ModelName>,\n        object_type: Qualified<CustomTypeName>,\n    },\n    #[error(\"model {model_name:} with arguments is unsupported as a global ID source\")]\n    ModelWithArgumentsAsGlobalIdSource { model_name: Qualified<ModelName> },\n}\n","sourceCodeStart":21,"sourceCodeEnd":50,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/relay/mod.rs#L21-L50","documentation":"Relay stage error: two different models (both named in the message) that implement the same object type are marked globalIdSource: true. Relay requires a unique global ID source per object type; the resolver cannot pick between them and aborts. Note the doubled space in the message is cosmetic.","triggerScenarios":"Two models with globalIdSource: true whose objectType mappings resolve to the same Qualified<CustomTypeName> — often the same model defined in two subgraphs/namespaces, or a duplicated model config.","commonSituations":"Copying a Relay-enabled model into another namespace without clearing the flag; consolidating models onto one type while both keep globalIdSource; federation-style setups where the same type is implemented per-subgraph.","solutions":["Pick one model to be the global ID source and remove globalIdSource: true from the other","If both models are accidental duplicates, delete one entirely","If types are meant to be distinct, fix the objectType mapping so they no longer collide"],"exampleFix":"# before\nmodels:\n  - name: Users\n    objectType: User\n    globalIdSource: true\n  - name: UsersV2\n    objectType: User\n    globalIdSource: true\n# after\nmodels:\n  - name: Users\n    objectType: User\n    globalIdSource: true\n  - name: UsersV2\n    objectType: User","handlingStrategy":"validation","validationCode":"fn check_single_global_id_source(models: &[Model]) -> Result<(), String> {\n    let mut seen: HashMap<_, Vec<_>> = HashMap::new();\n    for m in models {\n        if m.global_id_source { seen.entry(m.object_type.clone()).or_default().push(m.name.clone()); }\n    }\n    for (ty, names) in seen {\n        if names.len() > 1 { return Err(format!(\"multiple globalIdSource models for {ty}: {names:?}\")); }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"catch DuplicateModelGlobalIdSource and print both model qualified names plus the shared object type","preventionTips":["One globalIdSource per object type across all namespaces","When duplicating models across subgraphs, clear globalIdSource on copies"],"tags":["relay","global-id","duplicate","metadata","hasura-ddn"],"backgroundTag":"relay-global-id-misconfiguration","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}