|
1 | | -:description: The Neo4j error codes for Neo4j version. |
| 1 | +:description: This page describes the structure of the error objects, the error codes, and how to interpret them. |
2 | 2 | [[neo4j-errors]] |
3 | 3 | = Server errors |
4 | 4 |
|
5 | | -// [role=label--version-5.25] |
6 | | -// [[gqlstatus-error-object]] |
7 | | -// == GQL-status error object |
8 | | - |
9 | | -// [[gqlstatus-standard-defined-codes]] |
10 | | -// === Standard-defined GQLSTATUS codes |
11 | | - |
12 | | -// .Standard-defined GQLSTATUS error codes |
13 | | -// [options="header", cols="<1s,<4"] |
14 | | -// [%collapsible] |
15 | | -// |=== |
16 | | -// |GQLSTATUS code | StatusDescription |
17 | | -// | 08000 | error: connection exception |
18 | | -// | 08007 | error: connection exception - transaction resolution unknown |
19 | | -// | 22000 | error: data exception |
20 | | -// | 22001 | error: data exception - string data, right truncation |
21 | | -// | 22003 | error: data exception - numeric value out of range. The numeric value `$value` is outside the required range. |
22 | | -// | 22004 | error: data exception - null value not allowed |
23 | | -// | 22007 | error: data exception - invalid date, time, or datetime format |
24 | | -// | 22008 | error: data exception - datetime field overflow |
25 | | -// | 22011 | error: data exception - substring error |
26 | | -// | 22012 | error: data exception - division by zero |
27 | | -// | 22015 | error: data exception - interval field overflow |
28 | | -// | 22018 | error: data exception - invalid character value for cast. The character value `$value` is an invalid argument for the specified cast. |
29 | | -// | 2201E | error: data exception - invalid argument for natural logarithm. The value `$value` is an invalid argument for the specified natural logarithm. |
30 | | -// | 2201F | error: data exception - invalid argument for power function. The value `$value` is an invalid argument for the specified power function. |
31 | | -// | 22027 | error: data exception - trim error |
32 | | -// | 2202F | error: data exception - array data, right truncation |
33 | | -// | 22G02 | error: data exception - negative limit value |
34 | | -// | 22G03 | error: data exception - invalid value type |
35 | | -// | 22G04 | error: data exception - values not comparable |
36 | | -// | 22G05 | error: data exception - invalid date, time, or datetime function field name |
37 | | -// | 22G06 | error: data exception - invalid datetime function value |
38 | | -// | 22G07 | error: data exception - invalid duration function field name |
39 | | -// | 22G0B | error: data exception - list data, right truncation |
40 | | -// | 22G0C | error: data exception - list element error |
41 | | -// | 22G0F | error: data exception - invalid number of paths or groups |
42 | | -// | 22G0H | error: data exception - invalid duration format. The duration format `$format` is invalid. |
43 | | -// | 22G0M | error: data exception - multiple assignments to a graph element property |
44 | | -// | 22G0N | error: data exception - number of node labels below supported minimum |
45 | | -// | 22G0P | error: data exception - number of node labels exceeds supported maximum |
46 | | -// | 22G0Q | error: data exception - number of edge labels below supported minimum |
47 | | -// | 22G0R | error: data exception - number of edge labels exceeds supported maximum |
48 | | -// | 22G0S | error: data exception - number of node properties exceeds supported maximum |
49 | | -// | 22G0T | error: data exception - number of edge properties exceeds supported maximum |
50 | | -// | 22G0U | error: data exception - record fields do not match |
51 | | -// | 22G0V | error: data exception - reference value, invalid base type |
52 | | -// | 22G0W | error: data exception - reference value, invalid constrained type |
53 | | -// | 22G0X | error: data exception - record data, field unassignable |
54 | | -// | 22G0Y | error: data exception - record data, field missing |
55 | | -// | 22G0Z | error: data exception - malformed path |
56 | | -// | 22G10 | error: data exception - path data, right truncation |
57 | | -// | 22G11 | error: data exception - reference value, referent deleted |
58 | | -// | 22G13 | error: data exception - invalid group variable value |
59 | | -// | 22G14 | error: data exception - incompatible temporal instant unit groups |
60 | | -// | 25000 | error: invalid transaction state |
61 | | -// | 25G01 | error: invalid transaction state - active GQL-transaction |
62 | | -// | 25G02 | error: invalid transaction state - catalog and data statement mixing not supported |
63 | | -// | 25G03 | error: invalid transaction state - read-only GQL-transaction |
64 | | -// | 25G04 | error: invalid transaction state - accessing multiple graphs not supported |
65 | | -// | 2D000 | error: invalid transaction termination |
66 | | -// | 40000 | error: transaction rollback |
67 | | -// | 40003 | error: transaction rollback - statement completion unknown |
68 | | -// | 42000 | error: syntax error or access rule violation |
69 | | -// | 42001 | error: syntax error or access rule violation - invalid syntax |
70 | | -// | 42002 | error: syntax error or access rule violation - invalid reference |
71 | | -// | 42004 | error: syntax error or access rule violation - use of visually confusable identifiers |
72 | | -// | 42006 | error: syntax error or access rule violation - number of edge labels below supported minimum |
73 | | -// | 42007 | error: syntax error or access rule violation - number of edge labels exceeds supported maximum |
74 | | -// | 42008 | error: syntax error or access rule violation - number of edge properties exceeds supported maximum |
75 | | -// | 42009 | error: syntax error or access rule violation - number of node labels below supported minimum |
76 | | -// | 42010 | error: syntax error or access rule violation - number of node labels exceeds supported maximum |
77 | | -// | 42011 | error: syntax error or access rule violation - number of node properties exceeds supported maximum |
78 | | -// | 42012 | error: syntax error or access rule violation - number of node type key labels below supported minimum |
79 | | -// | 42013 | error: syntax error or access rule violation - number of node type key labels exceeds supported maximum |
80 | | -// | 42014 | error: syntax error or access rule violation - number of edge type key labels below supported minimum |
81 | | -// | 42015 | error: syntax error or access rule violation - number of edge type key labels exceeds supported maximum |
82 | | -// | G1000 | error: dependent object error |
83 | | -// | G1001 | error: dependent object error - edges still exist |
84 | | -// | G1002 | error: dependent object error - endpoint node is deleted |
85 | | -// | G1003 | error: dependent object error - endpoint node not in current working graph |
86 | | -// | G2000 | error: graph type violation |
87 | | -// |=== |
88 | | - |
89 | | -// [[gqlstatus-neo4j-defined-codes]] |
90 | | -// === Neo4j-defined GQLSTATUS error codes |
| 5 | +A server error is returned by the Neo4j DBMS to indicate that the outcome of a Cypher query or command execution is not successful. |
| 6 | +The driver receives these errors and sends them to the client, which displays them to the user. |
91 | 7 |
|
| 8 | +Starting from version 5.25, Neo4j has a new GqlStatusObject API in addition to the existing HasStatus API. |
| 9 | +The GqlStatusObject API provides information about the status of a Cypher query or command execution in compliance with the GQL standard. |
| 10 | + |
| 11 | +This page describes both the Neo4j error and the GQL-status object frameworks, how they are structured, the objects they provide for errors, and how to interpret them. |
| 12 | +//It also explains the server error grouping and filtering, the error internals, and the server-driver compatibility for both the HasStatus and GqlStatusObject APIs. |
| 13 | + |
| 14 | + |
| 15 | +[role=label--version-5.23] |
| 16 | +[[gqlstatus-error-object]] |
| 17 | +== GQL-status error object |
| 18 | + |
| 19 | +In the GQL-status object framework, errors are an implementation-defined subset of the GQL-status objects that cover exceptions. |
| 20 | + |
| 21 | +In GQL, the execution of a query from user to server always has an outcome, called the _execution outcome_. |
| 22 | +The execution outcome is a list of GQL-status objects, ordered by the following precedence, where the first object in the list is the primary GQL-status object: |
| 23 | + |
| 24 | +. Every exception condition for transaction rollback has precedence over every other exception condition. |
| 25 | +. Every exception condition has precedence over every completion condition. |
| 26 | + |
| 27 | +The GQL-status object also includes the Neo4j-specific information, such as the severity level and the classification of the error. |
| 28 | + |
| 29 | +Each GQL-status object consists of the following fields: |
| 30 | + |
| 31 | +.GQLSTATUS error object |
| 32 | +[cols="<1s,<4"] |
| 33 | +|=== |
| 34 | +|GQLSTATUS code |
| 35 | +a| A 5-character string that is the concatenation of a 2-character class code followed by a 3-character subclass code. |
| 36 | +|StatusDescription |
| 37 | +a| A human-readable description of the GQLSTATUS, which consists of a condition, a subcondition, and a description. |
| 38 | +The condition and subcondition are textual representations of the class and subclass codes, respectively. |
| 39 | +| DiagnosticRecord |
| 40 | +a| Extra information about the status, given as key-value pairs, both on the server and driver side. |
| 41 | +To retrieve the full diagnostic record, you can use the `diagnosticRecord()` method on both the server and driver sides. |
| 42 | +Additional helper methods are exposed for some useful fields. |
| 43 | +[cols="<1s,<4"] |
| 44 | +!=== |
| 45 | +! Field ! Description |
| 46 | +! `OPERATION` ! The operation that the error is related to. Always defaults to empty. |
| 47 | +! `OPERATION_CODE` ! The operation code that the error is related to. Always defaults to `0`. |
| 48 | +! `CURRENT_SCHEMA` ! The current schema that the error is related to. Always defaults to `/`. |
| 49 | +! `_severity` a! The Neo4j severity level of the error, which is always `ERROR`. |
| 50 | +!`_classification` ! The Neo4j category of the error, which can be `CLIENT_ERROR`, `TRANSIENT_ERROR`, or `DATABASE_ERROR`. |
| 51 | +! `_position` ! The position, given by row and column, where the error is relevant in the query text. |
| 52 | +//! `_status_parameters`! A map that contains all variable parts of the status description. |
| 53 | +!=== |
| 54 | +|=== |
| 55 | + |
| 56 | +A GQL-status error object can also contain an optional nested GQL-status object for providing additional diagnostic information, such as a cause, which is a GQL-status object wrapped in another GQL-status object. |
| 57 | + |
| 58 | +[[gqlstatus-neo4j-defined-codes]] |
| 59 | +== Classes of GQLSTATUS error codes |
| 60 | + |
| 61 | +The Neo4j-defined GQLSTATUS codes are divided into classes and subclasses, where the class code is a 2-character string (one of `00`, `01`, or `03`) and the subclass code is a 3-character string. |
| 62 | +The class code indicates the general condition of the status (such as successful completion, warning, or information), and the subclass code provides more detailed information about the condition, such as classification and messages. |
| 63 | + |
| 64 | +The following table lists the Neo4j-defined groups of GQLSTATUS codes and their meanings: |
| 65 | + |
| 66 | +.GQLSTATUS groups of codes as defined by Neo4j |
| 67 | +[frame="topbot", stripes=odd, grid="cols", cols="<1s,<4"] |
| 68 | +|=== |
| 69 | +|GQLSTATUS code |
| 70 | +|*Description* |
| 71 | + |
| 72 | +| 01N0[y] |
| 73 | +| Deprecation warnings |
| 74 | + |
| 75 | +| 01N3[y] |
| 76 | +| Hint warnings |
| 77 | + |
| 78 | +| 01N4[y] |
| 79 | +| Unsupported warnings |
| 80 | + |
| 81 | +| 01N5[y] |
| 82 | +| Unrecognized warnings |
| 83 | + |
| 84 | +| 01N6[y] |
| 85 | +| Generic warnings |
| 86 | + |
| 87 | +| 01N7[y] |
| 88 | +| Security warnings |
| 89 | + |
| 90 | +| 03N9[y] |
| 91 | +| Performance information |
| 92 | + |
| 93 | +| 03N6[y] |
| 94 | +| Generic information |
| 95 | + |
| 96 | +| 00N5[y] |
| 97 | +| Unrecognized information under successful completion |
| 98 | + |
| 99 | +| 00N6[y] |
| 100 | +| Generic information under successful completion |
| 101 | + |
| 102 | +| 00N7[y] |
| 103 | +| Security information under successful completion |
| 104 | + |
| 105 | +| 00N8[y] |
| 106 | +| Topology information under successful completion |
| 107 | + |
| 108 | +|=== |
| 109 | + |
| 110 | +[[neo4j-error-object]] |
| 111 | +== Neo4j error object |
| 112 | + |
| 113 | +The Neo4j error object contains diagnostic information representing the *unsuccessful* outcome of a Cypher query or command execution, including severity, status code, category, description, message, and position in the query text where the error is relevant. |
| 114 | +Depending on the application, some of the fields from the error object might not be visible. |
| 115 | + |
| 116 | +The error object consists of the following fields: |
| 117 | + |
| 118 | +.Neo4j error object |
| 119 | +[cols="<1s,<4"] |
| 120 | +|=== |
| 121 | +|Neo4j code |
| 122 | +a|The Neo4j status code in the form of `Neo.[Type].[SubType].[Name]`. |
| 123 | +|Description |
| 124 | +a|The description of the specific error. |
| 125 | +|Message |
| 126 | +a|The error message. |
| 127 | +|Severity level |
| 128 | +a|`ERROR` |
| 129 | +|Category |
| 130 | +a|The category of the error. |
| 131 | +Available categories are `CLIENT_ERROR`, `TRANSIENT_ERROR`, and `DATABASE_ERROR`. |
| 132 | +|Position |
| 133 | +a|The position, given by row and column, where the error is relevant in the query text. |
| 134 | +|=== |
| 135 | + |
| 136 | +[[error-grouping-and-filtering]] |
| 137 | +== Server error classification |
| 138 | + |
| 139 | +The fact that a Neo4j status code is returned by the server does not always mean there is a fatal error. |
| 140 | +Neo4j status codes can also indicate transient problems that may go away if you retry the request. |
| 141 | +The status code classification determines the effect on the transaction. |
| 142 | + |
| 143 | +.Neo4j status code types |
| 144 | +[options="header", cols="<1m,<2,<1"] |
| 145 | +|=== |
| 146 | + |
| 147 | +| Type |
| 148 | +| Description |
| 149 | +| Effect on the transaction |
| 150 | + |
| 151 | +| xref:errors/all-errors.adoc#_client_errors[ClientError] |
| 152 | +| The client sent a bad request - changing the request might yield a successful outcome. |
| 153 | +| Rollback |
| 154 | + |
| 155 | +| xref:errors/all-errors#_transient_errors[TransientError] |
| 156 | +| The database cannot service the request right now, retrying later might yield a successful outcome. |
| 157 | +| Rollback |
| 158 | + |
| 159 | +| xref:errors/all-errors#_database_error[DatabaseError] |
| 160 | +| The database failed to service the request. |
| 161 | +| Rollback |
| 162 | + |
| 163 | +|=== |
| 164 | + |
| 165 | +[[error-internals]] |
| 166 | +== Error internals |
| 167 | + |
| 168 | +The server and driver communicate with each other through the Bolt protocol. |
| 169 | +During the handshake process, they agree on using the newest possible Bolt protocol version that both the server and the driver support. |
| 170 | +For more information on the Bolt versions supported by different server versions, see the link:https://neo4j.com/docs/bolt/current/bolt-compatibility[Bolt Protocol documentation]. |
| 171 | + |
| 172 | +Neo4j supports server errors in the form of Java exceptions. |
| 173 | +Most of these implement the `HasStatus` interface, which means they have a Neo4j status code in addition to the exception message. |
| 174 | + |
| 175 | +On the server side, an exception contains normal Java constructors and methods like `getMessage()`, `getCause()`, etc., and additionally the `status()` method from the `HasStatus` API, which returns the Neo4j status code. |
| 176 | +These exceptions are then sent to the driver as failure Bolt message metadata. |
| 177 | + |
| 178 | + |
| 179 | +[[server-driver-compatibility]] |
| 180 | +== Server-driver version compatibility |
0 commit comments