// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements.  See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License.  You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

= Exceptions

This section outlines basic exceptions that can be generated by Ignite 3 and provides basic instructions for handling them.

== Finding Stack Trace Information

When the exception happens, Ignite 3 provides a UUID of the specific exception, but not a full stack trace. For a full stack trace, check cluster logs.

== Common Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-CMN-1`|Operation was stopped because node is stopping.
|`IGN-CMN-2`|Operation was stopped because the component is not started.
|`IGN-CMN-3`|Operation failed because an illegal argument or argument in a wrong format has been passed.
|`IGN-CMN-4`|Operation failed because SSL could not be configured.
|`IGN-CMN-5`|Operation failed because a node has left the cluster.
|===

== Table Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-TBL-1`|Table already exists.
|`IGN-TBL-2`|Table not found.
|`IGN-TBL-3`|Column already exists.
|`IGN-TBL-4`|Column not found.
|`IGN-TBL-5`|Table is already stopping.
|`IGN-TBL-6`|Table definition not correct.
|`IGN-TBL-7`|Schema version mismatch.
|===

== Client Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-CLIENT-1`|Connection to client failed.
|`IGN-CLIENT-2`|An issue occurred with connection protocol.
|`IGN-CLIENT-3`|Incompatible protocol version.
|`IGN-CLIENT-4`|Failed to find the table by ID.
|`IGN-CLIENT-5`|An error occurred during authentication.
|`IGN-CLIENT-6`|An error occurred during authorization.
|`IGN-CLIENT-7`|Client configuration error.
|`IGN-CLIENT-8`|Cluster ID mismatch error.
|`IGN-CLIENT-9`|Client SSL configuration error.
|`IGN-CLIENT-10`|Client handshake header error.
|===

== SQL  Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-SQL-1`|Failed to read response from a query that does not return rows.
|`IGN-SQL-2`|Schema not found error.
|`IGN-SQL-3`|Statement parsing error. SQL string is not grammatically valid.
|`IGN-SQL-4`|Statement validation error.SQL string is not semantically valid or contains prohibited operations.
|`IGN-SQL-5`|Constraint violation error, for example, primary key violation.
|`IGN-SQL-6`|Statement got cancelled.
|`IGN-SQL-7`|Runtime error. Usually caused an SQL error, for example numeric overflow.
|`IGN-SQL-8`|SQL engine was unable to map query on current cluster topology. Most likely, the partition or view is not available because all nodes containing it are offline.
|`IGN-SQL-9`|Execution of transaction control statement inside an external transaction is forbidden.
|===

== Meta Storage Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-META-1`|Failed to start the underlying key value storage.
|`IGN-META-2`|Failed to restore the underlying key value storage.
|`IGN-META-3`|Failed to compact the underlying key value storage.
|`IGN-META-4`|Failed to perform an operation on the underlying key value storage.
|`IGN-META-5`|Failed to perform an operation within a specified time period.
|===

== Index Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-IDX-1`|Invalid index definition.
|`IGN-IDX-2`|Failed to find the specified index.
|`IGN-IDX-3`|Specified index already exists.
|===

== Transactions Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-TX-1`|Default error for transaction state storage.
|`IGN-TX-2`|Transaction state storage is stopped.
|`IGN-TX-3`|Unexpected transaction state on state change.
|`IGN-TX-4`|Failed to acquire a lock on a key due to a conflict.
|`IGN-TX-5`|Failed to acquire a lock on a key within the timeout.
|`IGN-TX-6`|Failed to commit a transaction.
|`IGN-TX-7`|Failed to roll back a transaction.
|`IGN-TX-8`|Failed to put read-write operation into read-only transaction.
|`IGN-TX-9`|Replica is not ready to handle a request.
|`IGN-TX-10`|Transaction state storage rebalancing error.
|`IGN-TX-11`|Failed to create a read-only transaction with a timestamp older than the data available in the tables.
|`IGN-TX-12`|Failure due to an incompatible schema change.
|`IGN-TX-13`|Failure due to an abandoned transaction.
|`IGN-TX-14`|Failure due to primary replica expiration.
|`IGN-TX-15`|Coordinator tried to commit a transaction that has already been aborted.
|===

== Replicator Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-REP-1`|Default error for the replication procedure.
|`IGN-REP-2`|Replica with the same identifier is already existed.
|`IGN-REP-3`|Timeout has happened during the replication procedure.
|`IGN-REP-4`|The error happens when the replication level try to handle an unsupported request.
|`IGN-REP-5`|The error happens when the replica is not ready to handle a request.
|`IGN-REP-6`|The error happens when the replica is not the current primary replica.
|`IGN-REP-7`|Failed to close cursor.
|`IGN-REP-8`|Stopping replica exception code.
|`IGN-REP-9`|Replication safe time reordering.

|===


== Storage Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-STORAGE-1`|Default error code for storage exceptions.
|`IGN-STORAGE-2`|Failed to create a directory.
|`IGN-STORAGE-3`|Operation on closed storage.
|`IGN-STORAGE-4`|Storage rebalancing error.
|===


== Distribution Zone Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-DISTRZONES-1`|Distribution zone already exists.
|`IGN-DISTRZONES-2`|Distribution zone is not found.
|`IGN-DISTRZONES-3`|Distribution zone renaming error.
|`IGN-DISTRZONES-4`|Distribution zone is a default distribution zone or bound to table.
|`IGN-DISTRZONES-5`|Distribution zone definition error.

|===


== Network Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-NETWORK-1`|Unresolvable consistent ID.
|`IGN-NETWORK-2`|Port is already in use.
|===

== Node Configuration Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-NODECFG-1`|Failed to read configuration.
|`IGN-NODECFG-2`|Failed to create a configuration file.
|`IGN-NODECFG-3`|Failed to write configuration.
|`IGN-NODECFG-4`|Failed to parse configuration.
|===


== Code Deployment Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-CODEDEPLOY-1`|Access attempt to a non-existing deployment unit.
|`IGN-CODEDEPLOY-2`|Duplicate deployment unit.
|`IGN-CODEDEPLOY-3`|Deployment unit content read error.
|`IGN-CODEDEPLOY-4`|Deployment unit is unavailable for computing.
|===

== Garbage Collector Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-GC-1`|Garbage collector closed.
|===

== Authentication Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-AUTHENTICATION-1`|Authentication error caused by unsupported authentication type.
|`IGN-AUTHENTICATION-2`|Authentication error caused by invalid credentials.
|===

== Compute Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-COMPUTE-1`|Classpath error.
|`IGN-COMPUTE-1`|Class loader error.
|===

== Catalog Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-CATALOG-1`|Command to the catalog has not passed the validation. See exception message for details.
|===

== Placement Driver Exceptions

[cols="20%,80%", width="100%",opts="header"]
|===
|Exception	|Description

|`IGN-PLACEMENTDRIVER-1`|Primary replica await timeout error.
|`IGN-PLACEMENTDRIVER-2`|Primary replica await error.
|===