hasura/graphql-engine · error · ApolloError
Model {model_name:} is marked as an Apollo Federation entity
Error message
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:} What it means
This is the inverse of error 855: a model is flagged apolloFederation.entitySource: true, but the object type it maps to has no apolloFederation.keys defined. An entity source without key fields cannot be referenced by federation queries, so the metadata resolver fails validation to flag the inconsistent configuration.
Source
Thrown at v3/crates/metadata-resolve/src/stages/apollo/mod.rs:62
},
#[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:}")]
MultipleEntitySourcesForType {
type_name: Qualified<CustomTypeName>,
},
}
View on GitHub (pinned to 724551b9ae)
Solutions
- Add an apolloFederation.keys entry (with valid, non-empty field lists) to the object type named in the error.
- Verify the model's graphql type_name matches the type that carries the keys.
- Alternatively, if federation is not intended for this model, remove the entitySource flag.
Example fix
# before
type: users
# no apolloFederation block
models:
users:
apolloFederation:
entitySource: true
# after
type: users
apolloFederation:
keys:
- [id]
models:
users:
apolloFederation:
entitySource: true Defensive patterns
Strategy: validation
Validate before calling
fn entity_config_consistent(types: &TypeMap, model: &Model) -> bool {
let type_name = model.graphql.type_name;
types.get(&type_name).and_then(|t| t.apollo_federation.as_ref())
.map(|af| !af.keys.is_empty()).unwrap_or(false)
} Prevention
- Add keys and entitySource flags in the same change.
- When renaming a type, move the whole apolloFederation block with it.
When it happens
Trigger: Marking a model with apolloFederation.entitySource: true while the object type named in the model's GraphQL mapping has no apolloFederation.keys block (or it was removed/renamed).
Common situations: Adding entitySource to a model but forgetting to add keys on the type; renaming the object type so the keys block stayed behind on the old type name; cleaning up 'unused' federation keys on a type while a model still references it as entity source.
Related errors
- empty fields in apollo federation keys defined for the objec
- unknown field {field_name:} in apollo federation keys define
- empty keys in apollo federation configuration defined for th
- 'apolloFederation.keys' for type {object_type:} found, but n
- model {model_name:} with arguments is unsupported as an Apol
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/93e7a046fa01215e.
Report an issue: GitHub.