Error codes
Each error found in GraphQL documents has a code such as nitrogql2001. Codes are shown in the output of the CLI and in diagnostics of the TypeScript content mapper. A code never changes its meaning once published, while messages may change between versions.
Codes are grouped by area: 1xxx for syntax errors, 2xxx for errors found in both schemas and operations, 3xxx for schemas, 4xxx for operations, 5xxx for #import, 8xxx for plugins, and 9xxx for everything else.
Syntax errors
| Code | Description | Example message |
|---|---|---|
nitrogql1001 | Syntax error in a GraphQL document. | Parse error: expected Selection |
Errors in schemas and operations
| Code | Description | Example message |
|---|---|---|
nitrogql2001 | Type is not defined. | Type 'Usr' is not defined |
nitrogql2002 | Directive is not defined. | Directive 'unknown' is not defined |
nitrogql2003 | Directive is not allowed for this location. | Directive 'skip' is not allowed for this location |
nitrogql2004 | Non-repeatable directive is applied more than once. | Repeated application of directive 'deprecated' is not allowed |
nitrogql2005 | Arguments are given to something that does not accept arguments. | This directive does not accept arguments |
nitrogql2006 | Argument is not defined. | Argument 'id' is not defined |
nitrogql2007 | Required argument is not specified. | Required argument 'id' is not specified |
nitrogql2008 | Value does not match the expected type. | This value does not match expected type 'Int!' |
nitrogql2009 | Variable is not defined. | Variable '$id' is not defined |
nitrogql2010 | Value is not a member of the enum. | 'PURPLE' is a member of enum Color |
nitrogql2011 | Field of an input object is not defined. | Field 'nam' is not defined |
nitrogql2012 | Required field of an input object is not specified. | Field 'name' is required |
nitrogql2013 | Value of a @oneOf input object does not have exactly one field. | Value of @oneOf input object 'UserBy' must have exactly one field |
nitrogql2014 | Field of a @oneOf input object is null. | Field 'id' of @oneOf input object must not be null |
nitrogql2015 | Variable used for a field of a @oneOf input object is nullable. | Variable '$id' used for a field of @oneOf input object must be of non-null type |
nitrogql2016 | Output type is used where an input type is expected. | Output type 'User' is not allowed here |
nitrogql2017 | Input type is used where an output type is expected. | Input type 'UserInput' is not allowed here |
Errors in schemas
| Code | Description | Example message |
|---|---|---|
nitrogql3001 | Name that starts with __ is reserved. | Name that starts with '__' is reserved |
nitrogql3002 | Name is duplicated. | Name 'id' is duplicated |
nitrogql3003 | Type, directive or schema is declared more than once. | Duplicated declaration of type 'User' |
nitrogql3004 | Extension has no original declaration. | type is extended, but there is no original declaration of type |
nitrogql3005 | Directive references itself. | Directive 'loop' is recursing |
nitrogql3006 | Implemented type is not an interface. | 'User' is not an interface |
nitrogql3007 | Type does not implement an interface that its interfaces implement. | This type must implement interface 'Node' |
nitrogql3008 | Interface implements itself. | Interface must not implement itself |
nitrogql3009 | Type does not have a field of its interface. | This type must have a field 'id' from interface 'Node' |
nitrogql3010 | Type of a field does not match the field of the interface. | Type of this field does not match the same field from interface 'Node' |
nitrogql3011 | Field does not have an argument of the same field of the interface. | This field must have an argument 'id' from interface 'Node' |
nitrogql3012 | Type of an argument does not match the argument of the interface. | Type of this argument does not match the same argument from interface 'Node' |
nitrogql3013 | Argument that the field of the interface does not have is of non-null type. | Type of this argument must be nullable because it is not in the same field from interface 'Node' |
nitrogql3014 | Member of a union is not an object type. | 'Node' is not an object type |
nitrogql3015 | Field of a @oneOf input object is of non-null type. | Field of @oneOf input object must not be of non-null type |
nitrogql3016 | Field of a @oneOf input object has a default value. | Field of @oneOf input object must not have a default value |
Errors in operations
| Code | Description | Example message |
|---|---|---|
nitrogql4001 | Unnamed operation is not the only operation in the document. | Unnamed operation must be the only operation in this document |
nitrogql4002 | Operation name is duplicated. | Duplicate query name |
nitrogql4003 | Fragment name is duplicated. | Duplicate fragment name |
nitrogql4004 | Root type for the operation is not defined. | Root type for mutation operation is not defined |
nitrogql4005 | Fields are selected on a type that does not have fields. | Cannot select fields of scalar 'Int' |
nitrogql4006 | Selection set is missing for a field of an object type. | Must specify selection set for field 'me' |
nitrogql4007 | Field is not found on the type. | Field 'nam' is not found on type 'User' |
nitrogql4008 | Variable name is duplicated. | Duplicated variable name 'id' |
nitrogql4009 | Type is not a valid fragment target. | Type 'Int' is not a valid fragment target |
nitrogql4010 | Fragment is not defined. | Fragment 'Missing' is not defined |
nitrogql4011 | Fragment condition never matches its scope type. | Fragment condition 'Query' never matches scope type 'User' |
nitrogql4012 | Fragment spreads itself. | Recursing application of fragment 'UserParts' |
nitrogql4013 | Subscription operation does not have exactly one root field. | Subscription operation must have exactly one root field |
nitrogql4014 | Fields with the same response name cannot be merged. | Fields 'name' conflict because 'name' and 'nickname' are different fields |
Errors in #import
See The #import syntax for details.
| Code | Description | Example message |
|---|---|---|
nitrogql5001 | Wildcard import is specified more than once. | Wildcard import should be specified only once |
nitrogql5002 | Wildcard import is combined with specific imports. | Wildcard import cannot be combined with specific import |
nitrogql5003 | Imported file is not found. | File './fragments.graphql' not found. |
nitrogql5004 | Imported fragment is not found in the imported file. | 'UserParts' is not found in the imported file './fragments.graphql'. |
Errors from plugins
| Code | Description | Example message |
|---|---|---|
nitrogql8001 | Error reported by a plugin. The message is provided by the plugin. |
Other errors
| Code | Description | Example message |
|---|---|---|
nitrogql9001 | Invalid option of the TypeScript content mapper. | Unknown option 'configFiles'. |
nitrogql9002 | Problem outside GraphQL documents, such as in the config file. The content mapper also uses this code for errors in other files that prevent loading the project. | Failed to load nitrogql project: Type 'Usr' is not defined |
nitrogql9999 | Internal error of nitrogql. If you see this error, please report it as a bug. | Cannot merge selections of field 'a' that have different shapes |
