Errors
Errors inheritance
Each error in EdgeDB consists of a code, a name, and optionally tags. Errors in EdgeDB can inherit from other errors. This is denoted by matching code prefixes. For example, TransactionConflictError (0x_05_03_01_00) is the parent error for TransactionSerializationError (0x_05_03_01_01) and TransactionDeadlockError (0x_05_03_01_02). The matching prefix here is 0x_05_03_01.
When the EdgeDB client expects a more general error and EdgeDB returns a more specific error that inherits from the general error, the check in the client must take this into account. This can be expressed by the binary and operation or & opeator in most programming languages:
(expected_error_code & server_error_code) == expected_error_code
Note that although it is not explicitly stated in the edb/api/errors.txt file, each inherited error must contain all tags of the parent error. Given that, TransactionSerializationError and TransactionDeadlockError, for example, must contain the SHOULD_RETRY tag that is defined for TransactionConflictError.
Error codes
Error codes and names as specified in edb/api/errors.txt:
## This source file is part of the EdgeDB open source project.## Copyright 2016-present MagicStack Inc. and the EdgeDB authors.## Licensed 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.#####0x_01_00_00_00 InternalServerError####0x_02_00_00_00 UnsupportedFeatureError####0x_03_00_00_00 ProtocolError0x_03_01_00_00 BinaryProtocolError0x_03_01_00_01 UnsupportedProtocolVersionError0x_03_01_00_02 TypeSpecNotFoundError0x_03_01_00_03 UnexpectedMessageError0x_03_02_00_00 InputDataError0x_03_02_01_00 ParameterTypeMismatchError0x_03_02_02_00 StateMismatchError #SHOULD_RETRY0x_03_03_00_00 ResultCardinalityMismatchError0x_03_04_00_00 CapabilityError0x_03_04_01_00 UnsupportedCapabilityError0x_03_04_02_00 DisabledCapabilityError####0x_04_00_00_00 QueryError0x_04_01_00_00 InvalidSyntaxError0x_04_01_01_00 EdgeQLSyntaxError0x_04_01_02_00 SchemaSyntaxError0x_04_01_03_00 GraphQLSyntaxError0x_04_02_00_00 InvalidTypeError0x_04_02_01_00 InvalidTargetError0x_04_02_01_01 InvalidLinkTargetError0x_04_02_01_02 InvalidPropertyTargetError0x_04_03_00_00 InvalidReferenceError0x_04_03_00_01 UnknownModuleError0x_04_03_00_02 UnknownLinkError0x_04_03_00_03 UnknownPropertyError0x_04_03_00_04 UnknownUserError0x_04_03_00_05 UnknownDatabaseError0x_04_03_00_06 UnknownParameterError0x_04_04_00_00 SchemaError0x_04_05_00_00 SchemaDefinitionError0x_04_05_01_00 InvalidDefinitionError0x_04_05_01_01 InvalidModuleDefinitionError0x_04_05_01_02 InvalidLinkDefinitionError0x_04_05_01_03 InvalidPropertyDefinitionError0x_04_05_01_04 InvalidUserDefinitionError0x_04_05_01_05 InvalidDatabaseDefinitionError0x_04_05_01_06 InvalidOperatorDefinitionError0x_04_05_01_07 InvalidAliasDefinitionError0x_04_05_01_08 InvalidFunctionDefinitionError0x_04_05_01_09 InvalidConstraintDefinitionError0x_04_05_01_0A InvalidCastDefinitionError0x_04_05_02_00 DuplicateDefinitionError0x_04_05_02_01 DuplicateModuleDefinitionError0x_04_05_02_02 DuplicateLinkDefinitionError0x_04_05_02_03 DuplicatePropertyDefinitionError0x_04_05_02_04 DuplicateUserDefinitionError0x_04_05_02_05 DuplicateDatabaseDefinitionError0x_04_05_02_06 DuplicateOperatorDefinitionError0x_04_05_02_07 DuplicateViewDefinitionError0x_04_05_02_08 DuplicateFunctionDefinitionError0x_04_05_02_09 DuplicateConstraintDefinitionError0x_04_05_02_0A DuplicateCastDefinitionError####0x_04_06_00_00 SessionTimeoutError0x_04_06_01_00 IdleSessionTimeoutError0x_04_06_02_00 QueryTimeoutError0x_04_06_0A_00 TransactionTimeoutError0x_04_06_0A_01 IdleTransactionTimeoutError####0x_05_00_00_00 ExecutionError0x_05_01_00_00 InvalidValueError0x_05_01_00_01 DivisionByZeroError0x_05_01_00_02 NumericOutOfRangeError0x_05_01_00_03 AccessPolicyError0x_05_02_00_00 IntegrityError0x_05_02_00_01 ConstraintViolationError0x_05_02_00_02 CardinalityViolationError0x_05_02_00_03 MissingRequiredError0x_05_03_00_00 TransactionError0x_05_03_01_00 TransactionConflictError #SHOULD_RETRY0x_05_03_01_01 TransactionSerializationError0x_05_03_01_02 TransactionDeadlockError####0x_06_00_00_00 ConfigurationError####0x_07_00_00_00 AccessError0x_07_01_00_00 AuthenticationError####0x_08_00_00_00 AvailabilityError0x_08_00_00_01 BackendUnavailableError #SHOULD_RETRY####0x_09_00_00_00 BackendError0x_09_00_01_00 UnsupportedBackendFeatureError####0x_F0_00_00_00 LogMessage0x_F0_01_00_00 WarningMessage#### Suggested errors for EdgeDB clients0x_FF_00_00_00 ClientError0x_FF_01_00_00 ClientConnectionError0x_FF_01_01_00 ClientConnectionFailedError0x_FF_01_01_01 ClientConnectionFailedTemporarilyError #SHOULD_RECONNECT #SHOULD_RETRY0x_FF_01_02_00 ClientConnectionTimeoutError #SHOULD_RECONNECT #SHOULD_RETRY0x_FF_01_03_00 ClientConnectionClosedError #SHOULD_RECONNECT #SHOULD_RETRY0x_FF_02_00_00 InterfaceError0x_FF_02_01_00 QueryArgumentError0x_FF_02_01_01 MissingArgumentError0x_FF_02_01_02 UnknownArgumentError0x_FF_02_01_03 InvalidArgumentError0x_FF_03_00_00 NoDataError0x_FF_04_00_00 InternalClientError