{"record":{"id":"13798742aba2022f","repo":"hasura/graphql-engine","slug":"apollofederation-keys-for-type-object-type-fo","errorCode":null,"errorMessage":"'apolloFederation.keys' for type {object_type:} found, but no model found with 'apolloFederation.entitySource: true' for type {object_type:}","messagePattern":"'apolloFederation\\.keys' for type (.+?) found, but no model found with 'apolloFederation\\.entitySource: true' for type (.+?)","errorType":"validation","errorClass":"ApolloError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/apollo/mod.rs","lineNumber":51,"sourceCode":"    #[error(\"empty fields in apollo federation keys defined for the object type {object_type:}\")]\n    EmptyFieldsInApolloFederationConfigForObject {\n        object_type: Qualified<CustomTypeName>,\n    },\n\n    #[error(\n        \"unknown field {field_name:} in apollo federation keys defined for the object type {object_type:}\"\n    )]\n    UnknownFieldInApolloFederationKey {\n        field_name: FieldName,\n        object_type: Qualified<CustomTypeName>,\n    },\n    #[error(\n        \"empty keys in apollo federation configuration defined for the object type {object_type:}\"\n    )]\n    EmptyKeysInApolloFederationConfigForObject {\n        object_type: Qualified<CustomTypeName>,\n    },\n    #[error(\n        \"'apolloFederation.keys' for type {object_type:} found, but no model found with 'apolloFederation.entitySource: true' for type {object_type:}\"\n    )]\n    ApolloFederationEntitySourceNotDefined {\n        object_type: Qualified<CustomTypeName>,\n    },\n    #[error(\n        \"model {model_name:} with arguments is unsupported as an Apollo Federation entity source\"\n    )]\n    ModelWithArgumentsAsApolloFederationEntitySource { model_name: Qualified<ModelName> },\n\n    #[error(\n        \"Model {model_name:} is marked as an Apollo Federation entity source but there are no keys fields present in the related object type {type_name:}\"\n    )]\n    NoKeysFieldsPresentInEntitySource {\n        type_name: Qualified<CustomTypeName>,\n        model_name: ModelName,\n    },\n    #[error(\"multiple models are marked as entity source for the object type {type_name:}\")]","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/apollo/mod.rs#L33-L69","documentation":"Thrown when metadata declares apolloFederation.keys for an object type, making it a Federation entity, but no model backing that type is marked with apolloFederation.entitySource: true. For Hasura to serve a federation entity, exactly one data source model must be flagged as the entity source; keys alone are not enough, so resolution fails.","triggerScenarios":"Adding apolloFederation.keys to a type while the corresponding model (the one mapped to that object type) lacks the apolloFederation.entitySource: true flag in its configuration.","commonSituations":"Following a federation tutorial and adding keys on the type but forgetting the entitySource flag on the model; entitySource set on a model mapped to a different type; entitySource misspelled or placed at the wrong level of the model config so it is silently ignored.","solutions":["Find the model that maps to the named object type and set apolloFederation.entitySource: true on it.","Verify the entitySource flag is spelled correctly and placed at the correct position in the model's metadata.","Make sure that model has no arguments (see the companion error for models with arguments) and that keys are defined on the related type.","Re-apply the metadata."],"exampleFix":"# before\nmodels:\n  users:\n    graphql:\n      type_name: users\n    # no apolloFederation block\n# after\nmodels:\n  users:\n    graphql:\n      type_name: users\n    apolloFederation:\n      entitySource: true","handlingStrategy":"validation","validationCode":"fn entity_source_defined(model: &Model) -> bool {\n    model.apollo_federation.as_ref().map(|a| a.entity_source).unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair every apolloFederation.keys on a type with entitySource: true on exactly one mapped model.","Use a metadata template that adds both sides together."],"tags":["hasura","apollo-federation","metadata","entity-source"],"backgroundTag":"apollo-federation-misconfiguration","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}