{"record":{"id":"56c0516898ae006e","repo":"hasura/graphql-engine","slug":"globalidfields-for-type-object-type-found-bu","errorCode":null,"errorMessage":"'globalIdFields' for type {object_type:} found, but no model found with 'globalIdSource: true' for type {object_type:}","messagePattern":"'globalIdFields' for type (.+?) found, but no model found with 'globalIdSource: true' for type (.+?)","errorType":"validation","errorClass":"RelayError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/relay/mod.rs","lineNumber":26,"sourceCode":"/// Ideally, we could move more Relay-based resolving into this discreet step, haven't\n/// investigated this too deeply yet.\npub fn resolve(\n    global_id_enabled_types: BTreeMap<Qualified<CustomTypeName>, Vec<Qualified<ModelName>>>,\n) -> Result<(), RelayError> {\n    // To check if global_id_fields are defined in object type but no model has global_id_source set to true:\n    //   - Throw an error if no model with globalIdSource:true is found for the object type.\n    for (object_type, model_name_list) in global_id_enabled_types {\n        if model_name_list.is_empty() {\n            return Err(RelayError::GlobalIdSourceNotDefined { object_type });\n        }\n    }\n\n    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>,","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/relay/mod.rs#L8-L44","documentation":"Relay stage error: an object type declares globalIdFields, but no model implementing that object type is flagged globalIdSource: true. The Relay global ID machinery needs exactly one backing model to build IDs from those fields, so resolution fails when the flag is missing.","triggerScenarios":"Adding globalIdFields to an object type in OpenDD metadata without setting globalIdSource: true on any model that implements that type; or setting the flag on a model targeting a different object type.","commonSituations":"Enabling Relay-style pagination incrementally — the type annotation lands but the model flag is forgotten; refactoring model-to-type mappings so the flagged model no longer implements the annotated type.","solutions":["Find the model that implements the object type named in the error and set globalIdSource: true on it","Verify the model's object type mapping actually points at the annotated type","If globalIdFields were added by mistake, remove them from the object type"],"exampleFix":"# before\nkind: Model\nname: Users\nobjectType: User\n# type User has globalIdFields: [id]\n# after\nkind: Model\nname: Users\nobjectType: User\nglobalIdSource: true","handlingStrategy":"validation","validationCode":"fn check_global_id_pairs(models: &[Model], types: &[ObjectType]) -> Result<(), String> {\n    for t in types {\n        if t.global_id_fields.is_empty() { continue; }\n        let ok = models.iter().any(|m| m.object_type == t.name && m.global_id_source);\n        if !ok { return Err(format!(\"type {} has globalIdFields but no globalIdSource model\", t.name)); }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"match on RelayError::GlobalIdSourceNotDefined and print the object type plus the models implementing it to guide the fix","preventionTips":["Add globalIdSource flag and globalIdFields in the same commit","Codemod or lint rule pairing the two settings per object type"],"tags":["relay","global-id","metadata","opendd","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"}