# Error codes

The Natural Access error codes are presented in two tables:

- Alphabetically by error code name, including a description of the problem and a possible solution.

- Numerically by hex number, decimal number, and error name.

All Natural Access functions return SUCCESS (0) or an error code indicating that the function failed and the reason for the failure. Natural Access error codes are defined in the ctaerr.h include file. The error codes are prefixed with CTAERR.

Error codes can also appear in the value field of a DONE event. Use the CTA_IS_ERROR macro to determine if a value is an error. The CTA_IS_ERROR macro is only applicable to DONE events.

## Alphabetical error summary

The following table lists the Natural Access errors in alphabetical order. All errors are 32 bit.

Error name | Hex | Decimal | Description
--- | --- | --- | ---
CTAERR_ALREADY_DEFINED | 0x10000009 | 268435465 | Problem: The service or service manager was already defined. Solution: Ensure that there is no redundancy in the services or service manager list specified in ctaInitialize and ctaCreateQueue.
CTAERR_ALREADY_INITIALIZED | 0x1E | 30 | The Natural Access library or a Natural Access service was already initialized.
CTAERR_BAD_ARGUMENT | 0x7 | 7 | Problem: A function argument value was invalid or a required pointer argument was NULL. Solution: Check all arguments for valid types and ranges.
CTAERR_BAD_NAME | 0x42 | 66 | The descriptor specified with ctaCreateContext or ctaCreateContextEx is already in use on the Natural Access Server.
CTAERR_BAD_SIZE | 0xB | 11 | Problem: A size argument was too small to receive a data structure, or a play or record buffer was not a multiple of the frame size for the specified encoding. Solution: Check all arguments for valid sizes.
CTAERR_BOARD_ERROR | 0x3 | 3 | An unexpected error occurred on the board. In most cases, a CTAEVN_BOARD_ERROR event contains the board error code.
CTAERR_CREATE_EVENT_FAILED | 0X2A | 42 | An operating system-specific event handler returned an error.
CTAERR_CREATE_MUTEX_FAILED | 0x1C | 28 | Failure to create a thread lock.
CTAERR_DISK_FULL | 0x29 | 41 | Problem: There is not enough room on the disk to complete the write operation. No data was written. Solution: Make some room on the disk.
CTAERR_DRIVER_ERROR | 0x18 | 24 | Problem: A device driver returned an error code. Solution: Check that device drivers are loaded and running.
CTAERR_DRIVER_OPEN_FAILED | 0x14 | 20 | The driver open failed because either the driver was not installed or the maximum number of opens was exceeded.
CTAERR_DRIVER_RECEIVE_FAILED | 0x16 | 22 | An error occurred when retrieving an event from a driver.
CTAERR_DRIVER_SEND_FAILED | 0x17 | 23 | A driver returned an error while sending a message. This error occurs on an AG board if the board is reset.
CTAERR_DRIVER_VERSION | 0x15 | 21 | The driver does not support the requested function.
CTAERR_DUPLICATE_CTAWAITOBJ | 0x2E | 46 | An already registered Natural Access wait object was passed as an argument to ctaRegisterWaitObject.
CTAERR_DUPLICATE_EXTPARMS | 0x10000003 | 268435458 | A duplicate parameter name exists in two services of the same name implemented by different service managers.
CTAERR_ENUM_END | 0x43 | 67 | End of list reached and no element was found with the specified index.
CTAERR_FATAL | 0x2 | 2 | An internal error occurred in Natural Access.
CTAERR_FILE_ACCESS_DENIED | 0x23 | 35 | Problem: Tried to open one of the following files: A file for writing that another application process or thread already opened for writing A read-only file for writing A file that has inadequate permissions A file using a directory name Solution: Open the file for read-only, change the file attributes or permissions, or specify a different file name.
CTAERR_FILE_CREATE_FAILED | 0x26 | 38 | Problem: File creation failed because of a system error. Solution: Verify that the path is valid and that the file does not already exist.
CTAERR_FILE_EXISTS | 0x24 | 36 | Problem: You attempted to create a file that already exists. Solution: Remove or rename the existing file, or specify a different file name.
CTAERR_FILE_NOT_FOUND | 0x21 | 34 | Problem: The specified file does not exist. Solution: Create the file or specify a different file name.
CTAERR_FILE_OPEN_FAILED | 0x25 | 37 | Problem: File open failed because of a system error. Solution: Verify that the file exists.
CTAERR_FILE_READ_FAILED | 0x27 | 39 | Problem: The file is not open, is locked, or the expected amount of data could not be read. Solution: Make sure that the file type is the expected type. Verify that an incorrect handle was not used to close another file.
CTAERR_FILE_WRITE_FAILED | 0x28 | 40 | Problem: The file is not open, is locked, or the expected amount of data could not be written. Solution: Verify that an incorrect handle was not used to close another file.
CTAERR_FUNCTION_ACTIVE | 0xF | 15 | One of the following occurred: Tried to start an asynchronous function that is already started. Tried to get a digit or flush the digit queue while collecting digits.
CTAERR_FUNCTION_NOT_ACTIVE | 0xE | 14 | Tried to stop or modify a function that is not running.
CTAERR_FUNCTION_NOT_AVAIL | 0xD | 13 | One of the following applies: The requested operation is not available with the current protocol. The necessary .dsp or .tcp file was not downloaded to the board. The requested function required a service that is reserved for use by the ADI service.
CTAERR_INCOMPATIBLE_PARMS | 0x10000001 | 268435457 | Problem: A discrepancy was detected in the definition of standard parameters of two identical services implemented by different service managers. Solution: Do not require both implementations of the same service in your application.
CTAERR_INCOMPATIBLE_REVISION | 0x11 | 17 | Problem: A service or service manager is incompatible with the Natural Access version being used. Solution: Ensure that all versions are compatible.
CTAERR_INCOMPATIBLE_SERVICES | 0x00000047 | 71 | On the server on which the context is created, at least one of the available services conflicts with the same service open on another server. An application can use only one instance of a service at a time.
CTAERR_INTERNAL_ERROR | 0x2D | 45 | A Natural Access internal error occurred.
CTAERR_INVALID_ADDRESS | 0x10000005 | 268435461 | Problem: Natural Access dispatcher detected an invalid command or event address. Solution: Ensure that all required services are initialized and open.
CTAERR_INVALID_BOARD | 0x1A | 26 | Problem: The specified board number was not successfully configured. Solution: Reconfigure the board.
CTAERR_INVALID_CTAHD | 0x5 | 5 | An invalid context handle was passed as an argument to a function, or the context was destroyed by another thread.
CTAERR_INVALID_CTAQUEUEHD | 0x4 | 4 | An invalid queue handle was passed as an argument to a function, or the queue was destroyed by another thread.
CTAERR_INVALID_HANDLE | 0x20 | 32 | An invalid handle was passed as an argument to this function.
CTAERR_INVALID_LIB | 0x45 | 69 | When using ctaInitialize, the setting for the ctaflags parameter specifies a library that is not supported by the linked Natural Access library.
CTAERR_INVALID_SEQUENCE | 0x13 | 19 | One of the following occurred: An attempt to open or close services was made while another request was pending. An attempt was made to stop a function that is already being stopped. A call control function was called before receiving a response to the previous call control command. A play or record buffer was submitted when it was not expected.
CTAERR_INVALID_STATE | 0xC | 12 | This function is not valid in the current state.
CTAERR_LICENSE_EXPIRED | 0x30 | 48 | The service license expired.
CTAERR_LOAD_LIB | 0x40 |  | An error occurred when loading the Natural Access core library.
CTAERR_LOCK_TIMEOUT | 0x1D | 29 | A thread lock timed out.
CTAERR_NO_LICENSE | 0x2F | 47 | No valid license for the specified service exists, or all available license units are in use.
CTAERR_NOT_FOUND | 0xA | 10 | One of the following occurred: The specified parameter does not exist. The service or service manager was not initialized, not attached to the queue, or not opened on the context. The application requested a service on a local or remote server that is not specified in the server configuration file.
CTAERR_NOT_IMPLEMENTED | 0x9 | 9 | The function was not implemented.
CTAERR_NOT_INITIALIZED | 0x1F | 31 | Problem: Natural Access was not yet initialized. Solution: Call ctaInitialize.
CTAERR_OS_INTERNAL_ERROR | 0x2C | 44 | An operating-system-specific error occurred.
CTAERR_OUT_OF_MEMORY | 0x6 | 6 | Problem: Unable to allocate memory for queue, for driver or context, for play or record buffers, or for temporary storage. Solution: When this error occurs on a DONE event, it can mean that there was insufficient memory on the board.
CTAERR_OUT_OF_RESOURCES | 0x8 | 8 | Problem: Unable to find free space in internal tables. Solution: Verify that handles are closed when no longer used.
CTAERR_OUTPUT_ACTIVE | 0x1B | 27 | Problem: Open services failed because the stream and timeslot are already open on another context, or an output function such as play failed because there is another active output function. Solution: Check another stream:timeslot or stop the running function.
CTAERR_PATH_NOT_FOUND | 0x22 | 33 | Problem: The directory portion of a file name is invalid. Solution: Create the directory or specify a different path.
CTAERR_RESOURCE_CONFLICT | 0x12 | 18 | Problem: A needed resource is already being used. Solution: Release the resource and try again.
CTAERR_SERVICE_IN_USE | 0x10000008 | 268435464 | Attempted to open a service (with ctaOpenServices) that is already open.
CTAERR_SERVICE_NOT_AVAILABLE | 0x10000006 | 268435462 | Problem: Attempted to call a service function on a context that does not have the service opened. Solution: Open the service before calling the service function.
CTAERR_SHAREMEM_ACCESS | 0x10 | 16 | Problem: Failed to access shared memory. Solution: Check that ctdaemon is running.
CTAERR_SVR_COMM | 0x41 | 65 | The server did not respond to the client application request within the required timeout period (by default, three seconds).
CTAERR_TOO_MANY_OPEN_FILES | 0x19 | 25 | Problem: No more available file handles in the current process. Solution: Close some files or increase the file handle limit.
CTAERR_TRACE_NOT_ENABLED | 0x1000000A | 268435466 | Problem: CTA_TRACE_ENABLE was not set during ctaInitialize. Solution: Ensure that CTA_TRACE_ENABLE is set.
CTAERR_WAIT_FAILED | 0x10000004 | 268435460 | An operating-system-specific wait function returned an error.
CTAERR_WAIT_PENDING | 0x10000003 | 268435459 | ctaWaitEvent was already called on the same queue handle.
CTAERR_WRONG_COMPAT_LEVEL | 0x34 | 52 | Problem: The compatibility level passed to ctaInitialize is different from the current level of Natural Access. Solution: Recompile the application.

## Numerical error summary

The following table lists the Natural Access errors in numerical order:

Hex | Decimal | Error name
--- | --- | ---
0x1 | 1 | CTAERR_RESERVED
0x2 | 2 | CTAERR_FATAL
0x3 | 3 | CTAERR_BOARD_ERROR
0x4 | 4 | CTAERR_INVALID_CTAQUEUEHD
0x5 | 5 | CTAERR_INVALID_CTAHD
0x6 | 6 | CTAERR_OUT_OF_MEMORY
0x7 | 7 | CTAERR_BAD_ARGUMENT
0x8 | 8 | CTAERR_OUT_OF_RESOURCES
0x9 | 9 | CTAERR_NOT_IMPLEMENTED
0xA | 10 | CTAERR_NOT_FOUND
0xB | 11 | CTAERR_BAD_SIZE
0xC | 12 | CTAERR_INVALID_STATE
0xD | 13 | CTAERR_FUNCTION_NOT_AVAIL
0xE | 14 | CTAERR_FUNCTION_NOT_ACTIVE
0xF | 15 | CTAERR_FUNCTION_ACTIVE
0x10 | 16 | CTAERR_SHAREMEM_ACCESS
0x11 | 17 | CTAERR_INCOMPATIBLE_REVISION
0x12 | 18 | CTAERR_RESOURCE_CONFLICT
0x13 | 19 | CTAERR_INVALID_SEQUENCE
0x14 | 20 | CTAERR_DRIVER_OPEN_FAILED
0x15 | 21 | CTAERR_DRIVER_VERSION
0x16 | 22 | CTAERR_DRIVER_RECEIVE_FAILED
0x17 | 23 | CTAERR_DRIVER_SEND_FAILED
0x18 | 24 | CTAERR_DRIVER_ERROR
0x19 | 25 | CTAERR_TOO_MANY_OPEN_FILES
0x1A | 26 | CTAERR_INVALID_BOARD
0x1B | 27 | CTAERR_OUTPUT_ACTIVE
0x1C | 28 | CTAERR_CREATE_MUTEX_FAILED
0x1D | 29 | CTAERR_LOCK_TIMEOUT
0x1E | 30 | CTAERR_ALREADY_INITIALIZED
0x1F | 31 | CTAERR_NOT_INITIALIZED
0x20 | 32 | CTAERR_INVALID_HANDLE
0x21 | 34 | CTAERR_FILE_NOT_FOUND
0x22 | 33 | CTAERR_PATH_NOT_FOUND
0x23 | 35 | CTAERR_FILE_ACCESS_DENIED
0x24 | 36 | CTAERR_FILE_EXISTS
0x25 | 37 | CTAERR_FILE_OPEN_FAILED
0x26 | 38 | CTAERR_FILE_CREATE_FAILED
0x27 | 39 | CTAERR_FILE_READ_FAILED
0x28 | 40 | CTAERR_FILE_WRITE_FAILED
0x29 | 41 | CTAERR_DISK_FULL
0x2A | 42 | CTAERR_CREATE_EVENT_FAILED
0x2B | 43 | CTAERR_EVENT_TIMEOUT
0x2C | 44 | CTAERR_OS_INTERNAL_ERROR
0x2D | 45 | CTAERR_INTERNAL_ERROR
0x2E | 46 | CTAERR_DUPLICATE_CTAWAITOBJ
0x2F | 47 | CTAERR_NO_LICENSE
0x30 | 48 | CTAERR_LICENSE_EXPIRED
0x34 | 52 | CTAERR_WRONG_COMPAT_LEVEL
0x40 | 64 | CTAERR_LOAD_LIB
0x41 | 65 | CTAERR_SVR_COMM
0x42 | 66 | CTAERR_BAD_NAME
0x43 | 67 | CTAERR_ENUM_END
0x44 | 68 | CTAERR_EVNT_BUF
0x45 | 69 | CTAERR_INVALID_LIB
0x47 | 71 | CTAERR_INCOMPATIBLE_SERVICES
0x10000001 | 268435457 | CTAERR_INCOMPATIBLE_PARMS
0x10000002 | 268435458 | CTAERR_DUPLICATE_EXTPARMS
0x10000003 | 268435459 | CTAERR_WAIT_PENDING
0x10000004 | 268435460 | CTAERR_WAIT_FAILED
0x10000005 | 268435461 | CTAERR_INVALID_ADDRESS
0x10000006 | 268435462 | CTAERR_SERVICE_NOT_AVAILABLE
0x10000007 | 268435463 | CTAERR_SERVICE_ERROR
0x10000008 | 268435464 | CTAERR_SERVICE_IN_USE
0x10000009 | 268435465 | CTAERR_ALREADY_DEFINED
0x1000000A | 268435466 | CTAERR_TRACE_NOT_ENABLED