{"record":{"id":"7f62d86bace31142","repo":"hasura/graphql-engine","slug":"model-model-name-is-marked-as-a-global-id-sourc","errorCode":null,"errorMessage":"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:}","messagePattern":"Model (.+?) is marked as a global ID source but there are no global id fields present in the related object type (.+?)","errorType":"validation","errorClass":"RelayError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/relay/mod.rs","lineNumber":32,"sourceCode":"    //   - 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>,\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":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/relay/mod.rs#L14-L50","documentation":"Relay stage error: a model is marked globalIdSource: true, but the object type it implements declares no globalIdFields. The model has nothing to derive the Relay global ID from, so metadata resolution fails.","triggerScenarios":"Setting globalIdSource: true on a model whose object type lacks a globalIdFields entry; adding the flag before annotating the type; renaming fields out of globalIdFields.","commonSituations":"Copy-pasting a Relay-enabled model config onto a type that was never prepared for global IDs; removing globalIdFields during a cleanup pass while leaving the model flag in place.","solutions":["Add globalIdFields (e.g. the primary key field list) to the object type named in the error","Or remove globalIdSource: true from the model if Relay IDs are not wanted for that type","Ensure the field names listed exist on the object type"],"exampleFix":"# before\nkind: ObjectType\nname: User\n# model User has globalIdSource: true\n# after\nkind: ObjectType\nname: User\nglobalIdFields: [id]","handlingStrategy":"validation","validationCode":"fn check_global_id_fields_present(models: &[Model], types: &[ObjectType]) -> Result<(), String> {\n    for m in models {\n        if !m.global_id_source { continue; }\n        let t = types.iter().find(|t| t.name == m.object_type)\n            .ok_or(\"model type missing\")?;\n        if t.global_id_fields.is_empty() {\n            return Err(format!(\"model {} is globalIdSource but type {} has no globalIdFields\", m.name, t.name));\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"downcast RelayError::NoGlobalFieldsPresentInGlobalIdSource and surface model_name/type_name in CI logs","preventionTips":["Never set globalIdSource without confirming the type lists globalIdFields","Remove the flag when removing globalIdFields during cleanup"],"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"}