{"record":{"id":"a708592d1c4c688c","repo":"hasura/graphql-engine","slug":"unknown-field-field-name-in-apollo-federation-k","errorCode":null,"errorMessage":"unknown field {field_name:} in apollo federation keys defined for the object type {object_type:}","messagePattern":"unknown field (.+?) in apollo federation keys defined for the object type (.+?)","errorType":"validation","errorClass":"ApolloError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/apollo/mod.rs","lineNumber":38,"sourceCode":"    // To check if apollo federation entity keys are defined in object type but no model has\n    // apollo_federation_entity_source set to true:\n    //   - Throw an error if no model with apolloFederation.entitySource:true is found for the object type.\n    for (object_type, model_name_list) in apollo_federation_entity_enabled_types {\n        if model_name_list.is_none() {\n            return Err(ApolloError::ApolloFederationEntitySourceNotDefined { object_type });\n        }\n    }\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    },","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/apollo/mod.rs#L20-L56","documentation":"Thrown by the Apollo Federation metadata stage when a federation key defined for an object type references a field name that does not exist on that object type. Entity keys must consist of real fields so a subgraph can resolve entities by those keys, so the resolver validates each key field against the type's field set and fails on the first unknown one.","triggerScenarios":"Configuring apolloFederation.keys: [[someField]] on a type where 'someField' is not among the type's fields — due to a typo, a renamed field, or a field that exists only on a different type.","commonSituations":"Renaming a model field without updating federation keys; typos in field names in hand-written metadata; copying a keys block from another type; keys referencing relationship/command fields that are not part of the object type's field set.","solutions":["Check the field set of the named object type and correct the key field name (spelling and casing must match exactly).","If the field was renamed, update the federation key to the new name.","If the key genuinely needs a field the type doesn't expose, add that field to the type first, or remove it from the key."],"exampleFix":"# before\ntype: users\napolloFederation:\n  keys:\n    - [user_id]   # field does not exist\n# after\ntype: users\napolloFederation:\n  keys:\n    - [id]        # actual field name","handlingStrategy":"validation","validationCode":"fn key_fields_exist(type_fields: &HashSet<String>, keys: &[Vec<String>]) -> bool {\n    keys.iter().flatten().all(|f| type_fields.contains(f))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When renaming a model field, grep metadata for federation key references to it.","Add a CI check that federation key fields are a subset of the type's field set."],"tags":["hasura","apollo-federation","metadata","entity-keys","field-validation"],"backgroundTag":"apollo-federation-misconfiguration","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}