{"record":{"id":"f26344bb73b36bcb","repo":"hasura/graphql-engine","slug":"empty-keys-in-apollo-federation-configuration-defi","errorCode":null,"errorMessage":"empty keys in apollo federation configuration defined for the object type {object_type:}","messagePattern":"empty keys in apollo federation configuration defined for the object type (.+?)","errorType":"validation","errorClass":"ApolloError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/apollo/mod.rs","lineNumber":45,"sourceCode":"    }\n    Ok(())\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum ApolloError {\n    #[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:}\"","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/apollo/mod.rs#L27-L63","documentation":"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.","triggerScenarios":"Adding an apolloFederation: {} or apolloFederation: keys: [] block to an object type in metadata without specifying any keys.","commonSituations":"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.","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."],"exampleFix":"# before\ntype: orders\napolloFederation:\n  keys: []\n# after\ntype: orders\napolloFederation:\n  keys:\n    - [id]\n# (or remove the apolloFederation block entirely)","handlingStrategy":"validation","validationCode":"fn has_keys(af: &Option<ApolloFederationConfig>) -> bool {\n    af.as_ref().map(|c| !c.keys.is_empty()).unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit the apolloFederation block entirely instead of leaving keys: [].","Treat placeholder federation config as a lint error in code review."],"tags":["hasura","apollo-federation","metadata","entity-keys"],"backgroundTag":"apollo-federation-misconfiguration","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}