hasura/graphql-engine · error · ApolloError
'apolloFederation.keys' for type {object_type:} found, but n
Error message
'apolloFederation.keys' for type {object_type:} found, but no model found with 'apolloFederation.entitySource: true' for type {object_type:} What it means
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.
Source
Thrown at v3/crates/metadata-resolve/src/stages/apollo/mod.rs:51
#[error("empty fields in apollo federation keys defined for the object type {object_type:}")]
EmptyFieldsInApolloFederationConfigForObject {
object_type: Qualified<CustomTypeName>,
},
#[error(
"unknown field {field_name:} in apollo federation keys defined for the object type {object_type:}"
)]
UnknownFieldInApolloFederationKey {
field_name: FieldName,
object_type: Qualified<CustomTypeName>,
},
#[error(
"empty keys in apollo federation configuration defined for the object type {object_type:}"
)]
EmptyKeysInApolloFederationConfigForObject {
object_type: Qualified<CustomTypeName>,
},
#[error(
"'apolloFederation.keys' for type {object_type:} found, but no model found with 'apolloFederation.entitySource: true' for type {object_type:}"
)]
ApolloFederationEntitySourceNotDefined {
object_type: Qualified<CustomTypeName>,
},
#[error(
"model {model_name:} with arguments is unsupported as an Apollo Federation entity source"
)]
ModelWithArgumentsAsApolloFederationEntitySource { model_name: Qualified<ModelName> },
#[error(
"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:}"
)]
NoKeysFieldsPresentInEntitySource {
type_name: Qualified<CustomTypeName>,
model_name: ModelName,
},
#[error("multiple models are marked as entity source for the object type {type_name:}")]View on GitHub (pinned to 724551b9ae)
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.
Example fix
# before
models:
users:
graphql:
type_name: users
# no apolloFederation block
# after
models:
users:
graphql:
type_name: users
apolloFederation:
entitySource: true Defensive patterns
Strategy: validation
Validate before calling
fn entity_source_defined(model: &Model) -> bool {
model.apollo_federation.as_ref().map(|a| a.entity_source).unwrap_or(false)
} Prevention
- Pair every apolloFederation.keys on a type with entitySource: true on exactly one mapped model.
- Use a metadata template that adds both sides together.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- model {model_name:} with arguments is unsupported as an Apol
- Model {model_name:} is marked as an Apollo Federation entity
- multiple models are marked as entity source for the object t
- empty fields in apollo federation keys defined for the objec
- unknown field {field_name:} in apollo federation keys define
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/13798742aba2022f.
Report an issue: GitHub.