aerospike.exception — Aerospike Exceptions

from __future__ import print_function

import aerospike
from aerospike import exception as ex

    config = { 'hosts': [ ('', 3000)], 'policies': { 'total_timeout': 1200}}
    client = aerospike.client(config).connect()
except ex.AerospikeError as e:
    print("Error: {0} [{1}]".format(e.msg, e.code))

New in version 1.0.44.

In Doubt Status

The in doubt status of a caught exception can be checked by looking at the 5th element of its args tuple

key = 'test', 'demo', 1
record = {'some': 'thing'}
  client.put(key, record)
except AerospikeError as exc:
  print("The in doubt nature of the operation is: {}".format(exc.args[4])

New in version 3.0.1.

Exception Types

exception aerospike.exception.AerospikeError

The parent class of all exceptions raised by the Aerospike client, inherits from exceptions.Exception . These attributes should be checked by executing `exc.args[i] where i is the index of the attribute. For example to check in_doubt, run exc.args[4]


The associated status code.


The human-readable error message.


True if it is possible that the operation succeeded.

exception aerospike.exception.ClientError

Exception class for client-side errors, often due to mis-configuration or misuse of the API methods. Subclass of AerospikeError.

exception aerospike.exception.InvalidHostError

Subclass of ClientError.

exception aerospike.exception.ParamError

The operation was not performed because of invalid parameters.

exception aerospike.exception.ServerError

The parent class for all errors returned from the cluster.

exception aerospike.exception.InvalidRequest

Protocol-level error. Subclass of ServerError.

exception aerospike.exception.OpNotApplicable

The operation cannot be applied to the current bin value on the server. Subclass of ServerError.

exception aerospike.exception.FilteredOut

The transaction was not performed because the predexp was false.

exception aerospike.exception.ServerFull

The server node is running out of memory and/or storage device space reserved for the specified namespace. Subclass of ServerError.

exception aerospike.exception.AlwaysForbidden

Operation not allowed in current configuration. Subclass of ServerError.

exception aerospike.exception.UnsupportedFeature

Encountered an unimplemented server feature. Subclass of ServerError.

exception aerospike.exception.DeviceOverload

The server node’s storage device(s) can’t keep up with the write load. Subclass of ServerError.

exception aerospike.exception.NamespaceNotFound

Namespace in request not found on server. Subclass of ServerError.

exception aerospike.exception.ForbiddenError

Operation not allowed at this time. Subclass of ServerError.

exception aerospike.exception.ElementExistsError

Raised when trying to alter a map key which already exists, when using a create_only policy.

Subclass of ServerError.

exception aerospike.exception.ElementNotFoundError

Raised when trying to alter a map key which does not exist, when using an update_only policy.

Subclass of ServerError.

exception aerospike.exception.RecordError

The parent class for record and bin exceptions exceptions associated with read and write operations. Subclass of ServerError.


The key identifying the record.


Optionally the bin associated with the error.

exception aerospike.exception.RecordKeyMismatch

Record key sent with transaction did not match key stored on server. Subclass of RecordError.

exception aerospike.exception.RecordNotFound

Record does not exist in database. May be returned by read, or write with policy aerospike.POLICY_EXISTS_UPDATE. Subclass of RecordError.

exception aerospike.exception.RecordGenerationError

Generation of record in database does not satisfy write policy. Subclass of RecordError.

exception aerospike.exception.RecordExistsError

Record already exists. May be returned by write with policy aerospike.POLICY_EXISTS_CREATE. Subclass of RecordError.

exception aerospike.exception.RecordBusy

Too may concurrent requests for one record - a “hot-key” situation. Subclass of RecordError.

exception aerospike.exception.RecordTooBig

Record being (re-)written can’t fit in a storage write block. Subclass of RecordError.

exception aerospike.exception.BinNameError

Length of bin name exceeds the limit of 14 characters. Subclass of RecordError.

exception aerospike.exception.BinIncompatibleType

Bin modification operation can’t be done on an existing bin due to its value type (for example appending to an integer). Subclass of RecordError.

exception aerospike.exception.IndexError

The parent class for indexing exceptions. Subclass of ServerError.


The name of the index associated with the error.

exception aerospike.exception.IndexNotFound

Subclass of IndexError.

exception aerospike.exception.IndexFoundError

Subclass of IndexError.

exception aerospike.exception.IndexOOM

The index is out of memory. Subclass of IndexError.

exception aerospike.exception.IndexNotReadable

Subclass of IndexError.

exception aerospike.exception.IndexNameMaxLen

Subclass of IndexError.

exception aerospike.exception.IndexNameMaxCount

Reached the maximum allowed number of indexes. Subclass of IndexError.

exception aerospike.exception.QueryError

Exception class for query errors. Subclass of AerospikeError.

exception aerospike.exception.QueryQueueFull

Subclass of QueryError.

exception aerospike.exception.QueryTimeout

Subclass of QueryError.

exception aerospike.exception.ClusterError

Cluster discovery and connection errors. Subclass of AerospikeError.

exception aerospike.exception.ClusterChangeError

A cluster state change occurred during the request. This may also be returned by scan operations with the fail-on-cluster-change flag set. Subclass of ClusterError.

exception aerospike.exception.AdminError

The parent class for exceptions of the security API.

exception aerospike.exception.ExpiredPassword

Subclass of AdminError.

exception aerospike.exception.ForbiddenPassword

Subclass of AdminError.

exception aerospike.exception.IllegalState

Subclass of AdminError.

exception aerospike.exception.InvalidCommand

Subclass of AdminError.

exception aerospike.exception.InvalidCredential

Subclass of AdminError.

exception aerospike.exception.InvalidField

Subclass of AdminError.

exception aerospike.exception.InvalidPassword

Subclass of AdminError.

exception aerospike.exception.InvalidPrivilege

Subclass of AdminError.

exception aerospike.exception.InvalidRole

Subclass of AdminError.

exception aerospike.exception.InvalidUser

Subclass of AdminError.

exception aerospike.exception.NotAuthenticated

Subclass of AdminError.

exception aerospike.exception.RoleExistsError

Subclass of AdminError.

exception aerospike.exception.RoleViolation

Subclass of AdminError.

exception aerospike.exception.SecurityNotEnabled

Subclass of AdminError.

exception aerospike.exception.SecurityNotSupported

Subclass of AdminError.

exception aerospike.exception.SecuritySchemeNotSupported

Subclass of AdminError.

exception aerospike.exception.UserExistsError

Subclass of AdminError.

exception aerospike.exception.UDFError

The parent class for UDF exceptions exceptions. Subclass of ServerError.


The UDF module associated with the error.


Optionally the name of the UDF function.

exception aerospike.exception.UDFNotFound

Subclass of UDFError.

exception aerospike.exception.LuaFileNotFound

Subclass of UDFError.

Exception Hierarchy

AerospikeError (*)
 +-- TimeoutError (9)
 +-- ClientError (-1)
 |    +-- InvalidHost (-4)
 |    +-- ParamError (-2)
 +-- ServerError (1)
      +-- InvalidRequest (4)
      +-- ServerFull (8)
      +-- AlwaysForbidden (10)
      +-- UnsupportedFeature (16)
      +-- DeviceOverload (18)
      +-- NamespaceNotFound (20)
      +-- ForbiddenError (22)
      +-- ElementNotFoundError (23)
      +-- ElementExistsError (24)
      +-- RecordError (*)
      |    +-- RecordKeyMismatch (19)
      |    +-- RecordNotFound (2)
      |    +-- RecordGenerationError (3)
      |    +-- RecordExistsError (5)
      |    +-- RecordTooBig (13)
      |    +-- RecordBusy (14)
      |    +-- BinNameError (21)
      |    +-- BinIncompatibleType (12)
      +-- IndexError (204)
      |    +-- IndexNotFound (201)
      |    +-- IndexFoundError (200)
      |    +-- IndexOOM (202)
      |    +-- IndexNotReadable (203)
      |    +-- IndexNameMaxLen (205)
      |    +-- IndexNameMaxCount (206)
      +-- QueryError (213)
      |    +-- QueryQueueFull (211)
      |    +-- QueryTimeout (212)
      +-- ClusterError (11)
      |    +-- ClusterChangeError (7)
      +-- AdminError (*)
      |    +-- SecurityNotSupported (51)
      |    +-- SecurityNotEnabled (52)
      |    +-- SecuritySchemeNotSupported (53)
      |    +-- InvalidCommand (54)
      |    +-- InvalidField (55)
      |    +-- IllegalState (56)
      |    +-- InvalidUser (60)
      |    +-- UserExistsError (61)
      |    +-- InvalidPassword (62)
      |    +-- ExpiredPassword (63)
      |    +-- ForbiddenPassword (64)
      |    +-- InvalidCredential (65)
      |    +-- InvalidRole (70)
      |    +-- RoleExistsError (71)
      |    +-- RoleViolation (81)
      |    +-- InvalidPrivilege (72)
      |    +-- NotAuthenticated (80)
      +-- UDFError (*)
           +-- UDFNotFound (1301)
           +-- LuaFileNotFound (1302)