Apollo Federation Error Codes
Reference for composition error codes
When GraphOS attempts to compose the schemas provided by your subgraphs into a supergraph schema, it confirms that:
- The subgraphs have valid GraphQL and Federation syntax
- The resulting supergraph schema is valid
- The graph router or gateway has all of the information it needs to execute operations against the resulting schema
If composition fails, a new supergraph schema cannot be generated. This document lists subgraph validation and composition error codes, along with their root causes.
ⓘ NOTE
Composition may flag potential improvements or hints on schemas which are technically valid. These hints aren't errors, and are instead logged as part of the composition build step. To learn more, see the composition hints doc.
Errors
The following errors might be raised during composition:
Error Code / Minimum Federation Version | Description |
---|---|
| An element is marked as |
| Error when composing custom directives. |
| A built-in or Federation directive has an invalid definition in the schema. Replaces |
| An element is marked as |
| Indicates an error in a subgraph service query during query execution in a federated service. |
| An enum type has no value common to all the subgraphs that define the type. Merging that type would result in an invalid empty enum type. |
| An input object type has no field common to all the subgraphs that define the type. Merging that type would result in an invalid empty input object type. |
| An enum type that is used as both an input and output type has a value that is not defined in all the subgraphs that define the enum type. |
| A subgraph is attempting to |
| An |
| An |
| An |
| The |
| A field is marked as |
| The field of an interface type is marked with |
| An |
| An |
| An argument (of a field/directive) has a default value that is incompatible with that of other declarations of that same argument in other subgraphs. |
| An argument (of a field/directive) has a type that is incompatible with that of other declarations of that same argument in other subgraphs. Replaces |
| A field has a type that is incompatible with other declarations of that field in other subgraphs. Replaces |
| An element is marked as |
| An input field has a default value that is incompatible with other declarations of that field in other subgraphs. |
| After subgraph merging, an implementation is missing a field of one of the interfaces it implements (which can happen for valid subgraphs). |
| A subgraph has a |
| A |
| Error in the usage of the |
| Indicates that a schema provided for an Apollo Federation supergraph is not a valid supergraph schema. |
| A field that is non-shareable in at least one subgraph is resolved by multiple subgraphs. |
| A schema is invalid GraphQL: it violates one of the rules of the specification. |
| An application of the |
| A URL/version for a |
| The |
| A subgraph name is invalid. (Subgraph names cannot be a single underscore ( |
| The |
| The |
| The |
| The value passed to the |
| The |
| A |
| The import name for a merged directive (as declared by the relevant |
| In a subgraph, a field is both marked |
| None of the composed subgraphs expose any query. |
| A type visible in the API schema has only |
| The |
| Field with |
| The |
| The |
| Field which is overridden to another subgraph is also marked |
| The |
| The |
| The |
| The value passed to the |
| The |
| A |
| A |
| An element is marked as |
| An element is marked as |
| An argument of a field or directive definition is mandatory in some subgraphs, but the argument is not defined in all the subgraphs that define the field or directive definition. |
| An element is marked as |
| A field of an input object type is mandatory in some subgraphs, but the field is not defined in all the subgraphs that define the input object type. |
| The |
| The |
| The value passed to the |
| The |
| A |
| A subgraph's schema defines a type with the name |
| A subgraph's schema defines a type with the name |
| A subgraph's schema defines a type with the name |
| Subgraphs can be merged, but the resulting supergraph API would have queries that cannot be satisfied by those subgraphs. |
| A shareable field return type has mismatched possible runtime types in the subgraphs in which the field is declared. As shared fields must resolve the same way in all subgraphs, this is almost surely a mistake. |
| The |
| Each |
| Each |
| Schemas using |
| The |
| If |
| The |
| The |
| The |
| If |
| The |
| The |
| The |
| If the |
| The |
| The |
| The |
| The |
| The |
| A built-in or Federation type has an invalid definition in the schema. |
| A type has the same name in different subgraphs, but a different kind. For instance, one definition is an object type but another is an interface. Replaces |
| A Federation 1 schema has a composite type comprised only of unused external fields. Note that this error can only be raised for Federation 1 schema as Federation 2 schema do not allow unused external fields (and errors with code |
| The version of Federation in a |
| The version of |
| Indicates an error due to feature currently unsupported by Federation. |
| Indicates that a feature used in a |
Removed codes
The following error codes have been removed and are no longer generated by the most recent version of the @apollo/gateway
library:
Removed code | Comment |
---|---|
| As duplicate enum definitions is invalid GraphQL, this will now be an error with code |
| As duplicate enum values are invalid in GraphQL, this will now be an error with code |
| As duplicate scalar definitions are invalid in GraphQL, this will now be an error with code |
| Subgraph definitions for an enum are now merged by composition. |
| As there is no type ownership anymore, there is also no particular limitation as to where a field can be external. |
| This error was thrown by a validation introduced to avoid running into a known runtime bug. Since Federation v2.3, the underlying runtime bug has been addressed and the validation/limitation was no longer necessary and has been removed. |
| Using |
| Keys can now use any field from any other subgraph. |
| Each subgraph is now free to declare a key only if it needs it. |
| Each subgraph can declare a key independently of any other subgraph. |
| Every subgraph can have multiple keys, as necessary. |
| Since Federation v2.1.0, the case this error used to cover is now a warning (with code |
|
|
|
|
| Since Federation v2.1.1, using fields with arguments in a |
| Fields in |
| As there is no type ownership anymore, there is also no particular limitation as to which subgraph can use a |
| This error was previously not correctly enforced: the service and entities, if present, were overridden; this is still the case. |
| There is no strong difference between entity and value types in the model (they are just usage patterns), and a type can have keys in one subgraph but not another. |
| Subgraph definitions for a union are now merged by composition. |