hasura/graphql-engine · error · ApolloError
empty keys in apollo federation configuration defined for th
Error message
empty keys in apollo federation configuration defined for the object type {object_type:} What it means
This error is raised by the Apollo Federation resolution stage when an object type has an apolloFederation configuration block whose keys array is empty. Federation configuration on a type implies it is (or relates to) an entity, which requires at least one key; an empty keys list is treated as invalid rather than meaningless.
Source
Thrown at v3/crates/metadata-resolve/src/stages/apollo/mod.rs:45
}
Ok(())
}
#[derive(Debug, thiserror::Error)]
pub enum ApolloError {
#[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:}"View on GitHub (pinned to 724551b9ae)
Solutions
- Either populate the keys array with at least one valid key (list of field names that exist on the type), or remove the apolloFederation block entirely from that object type.
- If you intended this type to be a federation entity, define proper keys and mark the corresponding model with apolloFederation.entitySource: true.
Example fix
# before
type: orders
apolloFederation:
keys: []
# after
type: orders
apolloFederation:
keys:
- [id]
# (or remove the apolloFederation block entirely) Defensive patterns
Strategy: validation
Validate before calling
fn has_keys(af: &Option<ApolloFederationConfig>) -> bool {
af.as_ref().map(|c| !c.keys.is_empty()).unwrap_or(false)
} Prevention
- Omit the apolloFederation block entirely instead of leaving keys: [].
- Treat placeholder federation config as a lint error in code review.
When it happens
Trigger: Adding an apolloFederation: {} or apolloFederation: keys: [] block to an object type in metadata without specifying any keys.
Common situations: Adding the apolloFederation block as scaffolding/placeholder and forgetting to fill in keys; programmatic metadata generation emitting the block only when a partial config is present; misunderstanding that entitySource alone (without keys) should be configured on the model side rather than as empty keys on the type.
Related errors
- empty fields in apollo federation keys defined for the objec
- unknown field {field_name:} in apollo federation keys define
- Model {model_name:} is marked as an Apollo Federation entity
- '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/f26344bb73b36bcb.
Report an issue: GitHub.