nitrogql logonitrogql

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

CodeDescriptionExample message
nitrogql1001Syntax error in a GraphQL document.Parse error: expected Selection

Errors in schemas and operations

CodeDescriptionExample message
nitrogql2001Type is not defined.Type 'Usr' is not defined
nitrogql2002Directive is not defined.Directive 'unknown' is not defined
nitrogql2003Directive is not allowed for this location.Directive 'skip' is not allowed for this location
nitrogql2004Non-repeatable directive is applied more than once.Repeated application of directive 'deprecated' is not allowed
nitrogql2005Arguments are given to something that does not accept arguments.This directive does not accept arguments
nitrogql2006Argument is not defined.Argument 'id' is not defined
nitrogql2007Required argument is not specified.Required argument 'id' is not specified
nitrogql2008Value does not match the expected type.This value does not match expected type 'Int!'
nitrogql2009Variable is not defined.Variable '$id' is not defined
nitrogql2010Value is not a member of the enum.'PURPLE' is a member of enum Color
nitrogql2011Field of an input object is not defined.Field 'nam' is not defined
nitrogql2012Required field of an input object is not specified.Field 'name' is required
nitrogql2013Value of a @oneOf input object does not have exactly one field.Value of @oneOf input object 'UserBy' must have exactly one field
nitrogql2014Field of a @oneOf input object is null.Field 'id' of @oneOf input object must not be null
nitrogql2015Variable 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
nitrogql2016Output type is used where an input type is expected.Output type 'User' is not allowed here
nitrogql2017Input type is used where an output type is expected.Input type 'UserInput' is not allowed here

Errors in schemas

CodeDescriptionExample message
nitrogql3001Name that starts with __ is reserved.Name that starts with '__' is reserved
nitrogql3002Name is duplicated.Name 'id' is duplicated
nitrogql3003Type, directive or schema is declared more than once.Duplicated declaration of type 'User'
nitrogql3004Extension has no original declaration.type is extended, but there is no original declaration of type
nitrogql3005Directive references itself.Directive 'loop' is recursing
nitrogql3006Implemented type is not an interface.'User' is not an interface
nitrogql3007Type does not implement an interface that its interfaces implement.This type must implement interface 'Node'
nitrogql3008Interface implements itself.Interface must not implement itself
nitrogql3009Type does not have a field of its interface.This type must have a field 'id' from interface 'Node'
nitrogql3010Type of a field does not match the field of the interface.Type of this field does not match the same field from interface 'Node'
nitrogql3011Field does not have an argument of the same field of the interface.This field must have an argument 'id' from interface 'Node'
nitrogql3012Type of an argument does not match the argument of the interface.Type of this argument does not match the same argument from interface 'Node'
nitrogql3013Argument 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'
nitrogql3014Member of a union is not an object type.'Node' is not an object type
nitrogql3015Field of a @oneOf input object is of non-null type.Field of @oneOf input object must not be of non-null type
nitrogql3016Field of a @oneOf input object has a default value.Field of @oneOf input object must not have a default value

Errors in operations

CodeDescriptionExample message
nitrogql4001Unnamed operation is not the only operation in the document.Unnamed operation must be the only operation in this document
nitrogql4002Operation name is duplicated.Duplicate query name
nitrogql4003Fragment name is duplicated.Duplicate fragment name
nitrogql4004Root type for the operation is not defined.Root type for mutation operation is not defined
nitrogql4005Fields are selected on a type that does not have fields.Cannot select fields of scalar 'Int'
nitrogql4006Selection set is missing for a field of an object type.Must specify selection set for field 'me'
nitrogql4007Field is not found on the type.Field 'nam' is not found on type 'User'
nitrogql4008Variable name is duplicated.Duplicated variable name 'id'
nitrogql4009Type is not a valid fragment target.Type 'Int' is not a valid fragment target
nitrogql4010Fragment is not defined.Fragment 'Missing' is not defined
nitrogql4011Fragment condition never matches its scope type.Fragment condition 'Query' never matches scope type 'User'
nitrogql4012Fragment spreads itself.Recursing application of fragment 'UserParts'
nitrogql4013Subscription operation does not have exactly one root field.Subscription operation must have exactly one root field
nitrogql4014Fields 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.

CodeDescriptionExample message
nitrogql5001Wildcard import is specified more than once.Wildcard import should be specified only once
nitrogql5002Wildcard import is combined with specific imports.Wildcard import cannot be combined with specific import
nitrogql5003Imported file is not found.File './fragments.graphql' not found.
nitrogql5004Imported fragment is not found in the imported file.'UserParts' is not found in the imported file './fragments.graphql'.

Errors from plugins

CodeDescriptionExample message
nitrogql8001Error reported by a plugin. The message is provided by the plugin.

Other errors

CodeDescriptionExample message
nitrogql9001Invalid option of the TypeScript content mapper.Unknown option 'configFiles'.
nitrogql9002Problem 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
nitrogql9999Internal error of nitrogql. If you see this error, please report it as a bug.Cannot merge selections of field 'a' that have different shapes