When Apollo Gateway attempts to compose the schemas provided by your subgraphs into a supergraph schema, it confirms that:
- The resulting supergraph schema is valid
- The gateway has all of the information it needs to execute operations against the resulting schema
If Apollo Gateway encounters an error, composition fails. This document lists composition error codes and their root causes.
| Code | Description | 
|---|
| EXTENSION_OF_WRONG_KIND | A subgraph is attempting to extendanother subgraph's type, but there is a declaration mismatch. For example,extend interface MyTypeis invalid ifMyTypeis not defined as aninterfacein its originating subgraph. | 
| EXTENSION_WITH_NO_BASE | A subgraph is attempting to extenda type that is not originally defined in any known subgraph. | 
| Code | Description | 
|---|
| KEY_FIELDS_SELECT_INVALID_TYPE | The fieldsargument of an entity's@keyincludes at least one root field that results in a list, interface, or union type. Root fields of these types cannot be part of a@key. | 
| KEY_FIELDS_MISSING_ON_BASE | The fieldsargument of an entity's@keyincludes at least one field that's also defined in another subgraph. Each field of an entity should be defined in exactly one subgraph. | 
| KEY_FIELDS_MISSING_EXTERNAL | A subgraph is attempting to extendanother subgraph's entity, but its@keyincludes at least one field that is not marked as@external. | 
| KEY_MISSING_ON_BASE | A subgraph is attempting to extendanother subgraph's entity, but the originating subgraph hasn't defined a@keyfor the entity. | 
| MULTIPLE_KEYS_ON_EXTENSION | A subgraph is attempting to extendanother subgraph's entity, but it's specified multiple@keydirectives. Extending subgraphs can only use one of the@keys specified by the originating subgraph. | 
| KEY_NOT_SPECIFIED | A subgraph is attempting to extendanother subgraph's entity, but it is using a@keythat is not specified in the originating subgraph. Valid@keys are specified by the owning subgraph. | 
| Code | Description | 
|---|
| EXTERNAL_UNUSED | An @externalentity field is not being used by any instance of@key,@requires, or@provides. | 
| EXTERNAL_TYPE_MISMATCH | An @externalentity field does not match the type of the declaration in the entity's originating subgraph. | 
| EXTERNAL_MISSING_ON_BASE | An entity field marked as @externalis not defined in the entity's originating subgraph. | 
| EXTERNAL_USED_ON_BASE | An entity field is marked as @externalin the entity's originating subgraph, which is invalid. | 
| Code | Description | 
|---|
| PROVIDES_FIELDS_MISSING_EXTERNAL | The fieldsargument of an entity field's@providesdirective includes a field that is not marked as@external. | 
| PROVIDES_NOT_ON_ENTITY | The @providesdirective is being applied to a type that is not an entity. | 
| PROVIDES_FIELDS_SELECT_INVALID_TYPE | The fieldsargument of an entity field's@providesdirective includes at least one root field that results in a list or interface. Root fields of these types cannot be included in@provides. | 
| Code | Description | 
|---|
| REQUIRES_FIELDS_MISSING_EXTERNAL | The fieldsargument of an entity field's@requiresdirective includes a field that is not marked as@external. | 
| REQUIRES_FIELDS_MISSING_ON_BASE | The fieldsargument of an entity field's@requiresdirective includes a field that is not defined in the entity's originating subgraph.` | 
| REQUIRES_USED_ON_BASE | An entity field is marked with @requiresin the entity's originating subgraph, which is invalid. | 
| Code | Description | 
|---|
| EXECUTABLE_DIRECTIVES_IN_ALL_SERVICES | A custom directive is not defined in a subgraph. All custom directives must be defined across all subgraphs, even if some of those definitions are a no-op. | 
| EXECUTABLE_DIRECTIVES_IDENTICAL | A custom directive is defined inconsistently across subgraphs. A directive's arguments and argument types, along with its supported schema locations, must match across all subgraphs.Only ExecutableDirectiveLocations are compared.TypeSystemDirectiveLocations are ignored during composition. | 
| Code | Description | 
|---|
| DUPLICATE_SCALAR_DEFINITION | A scalar type is defined multiple times in a single subgraph. | 
| DUPLICATE_ENUM_DEFINITION | An enum type is defined multiple times in a single subgraph. | 
| DUPLICATE_ENUM_VALUE | One of an enum type's values is defined multiple times. Duplicate values can be in either the enum's originating subgraph or another subgraph that extends the enum. | 
| ENUM_MISMATCH | An enum's values do not match across all subgraphs. Even if a subgraph does not use all enum values, they still must be provided if another subgraph uses them.This error lists which subgraphs have matching definitions. For example, [serviceA, serviceB], [serviceC]indicates thatserviceAandserviceBhave matching enum definitions, butserviceCdoes not match the other definitions. | 
| ENUM_MISMATCH_TYPE | An enum is defined with the same name as a non-enum type in another subgraph. | 
| Code | Description | 
|---|
| RESERVED_FIELD_USED | A subgraph defines a field name that is reserved by Apollo Federation, such as Query._serviceorQuery._entities. | 
| ROOT_QUERY_USED | A subgraph's schema defines a type with the name Query, while also specifying a different type name as the root query object. This is not allowed. | 
| ROOT_MUTATION_USED | A subgraph's schema defines a type with the name Mutation, while also specifying a different type name as the root mutation object. This is not allowed. | 
| ROOT_SUBSCRIPTION_USED | A subgraph's schema defines a type with the name Subscription, while also specifying a different type name as the root subscription object. This is not allowed. | 
| Code | Description | 
|---|
| VALUE_TYPE_FIELD_TYPE_MISMATCH | Multiple subgraphs define the same value type, but with mismatched fields. Value types must match across all subgraphs that define them. | 
| VALUE_TYPE_INPUT_VALUE_MISMATCH | Multiple subgraphs define the same value type, but with mismatched input values for fields. Value types and input values for fields must match across all subgraphs that define them. | 
| VALUE_TYPE_NO_ENTITY | Multiple subgraphs define the same value type, but at least one subgraph assigns it a @key. Either remove the@keyor convert the type to an entity andextendit. | 
| VALUE_TYPE_UNION_TYPES_MISMATCH | Multiple subgraphs define the same union type, but with mismatched sets of types. Union types must match across all subgraphs that define them. | 
| VALUE_TYPE_KIND_MISMATCH | A subgraph defines a type with the same name and fields as a type in another subgraph, but there is a declaration mismatch. For example, type MyTypeis invalid if another subgraph definesinterface MyType. | 
| Code | Description | 
|---|
| Unique type names | Type definitions cannot be duplicated across subgraphs, with the exception of enums, scalars, and value types. This is a modified version of the graphql-jsvalidation with exclusions for enums and scalars, because those are required to be duplicated across subgraphs. |