> ## Documentation Index
> Fetch the complete documentation index at: https://docs.decibel.trade/llms.txt
> Use this file to discover all available pages before exploring further.

# Error responses

> Error codes and handling for TypeScript SDK functions

## place\_order\_to\_subaccount

| Error Code | Module                  | Error Name                                                     | When It Occurs                           |
| ---------- | ----------------------- | -------------------------------------------------------------- | ---------------------------------------- |
| 1          | builder\_code\_registry | EINVALID\_AMOUNT                                               | Builder fees \<= 0                       |
| 1          | tp\_sl\_utils           | EINVALID\_TP\_SL\_PARAMETERS                                   | Invalid TP/SL parameters                 |
| 1          | order\_placement\_utils | EINVALID\_MATCH\_COUNT                                         | Match count validation error             |
| 1          | clearinghouse\_perp     | EINVALID\_ARGUMENT                                             | Invalid argument                         |
| 2          | clearinghouse\_perp     | EINVALID\_SIZE\_IS\_ZERO                                       | Size == 0 in settlement                  |
| 2          | builder\_code\_registry | EBUILDER\_NOT\_REGISTERED                                      | Builder not registered                   |
| 2          | async\_matching\_engine | EINVALID\_TP\_SL\_FOR\_REDUCE\_ONLY                            | TP/SL with reduce\_only                  |
| 3          | clearinghouse\_perp     | EINVALID\_SIZE\_IS\_TOO\_LARGE                                 | Size too large                           |
| 3          | dex\_accounts           | ENOT\_SUBACCOUNT\_OWNER\_OR\_LACKS\_PERP\_TRADING\_PERMISSIONS | Signer lacks trading permissions         |
| 3          | async\_matching\_engine | EINVALID\_TP\_SL\_WITH\_TRIGGER\_CONDITION                     | TP/SL with stop\_price                   |
| 4          | builder\_code\_registry | EINVALID\_MAX\_FEE                                             | Builder fees exceed max fee              |
| 4          | perp\_market\_config    | ESIZE\_NOT\_RESPECTING\_MIN\_SIZE                              | Size \< min\_size                        |
| 4          | perp\_engine            | EMARKET\_HALTED                                                | Exchange is not open                     |
| 4          | clearinghouse\_perp     | EINVALID\_PRICE\_IS\_ZERO                                      | Price == 0                               |
| 4          | async\_matching\_engine | EINVALID\_STOP\_PRICE                                          | Invalid stop\_price                      |
| 5          | clearinghouse\_perp     | EINVALID\_PRICE\_IS\_TOO\_LARGE                                | Price too large                          |
| 5          | pending\_order\_tracker | E\_INVALID\_REDUCE\_ONLY\_ORDER                                | Invalid reduce-only order                |
| 5          | async\_matching\_engine | EINVALD\_WORK\_UNITS\_PER\_TRIGGER                             | Invalid work units                       |
| 6          | perp\_market\_config    | EPRICE\_NOT\_RESPECTING\_TICKER\_SIZE                          | Price not multiple of ticker\_size       |
| 6          | clearinghouse\_perp     | EINVALID\_SETTLE\_RESULT                                       | Invalid settlement result                |
| 7          | clearinghouse\_perp     | ESELF\_TRADE\_NOT\_ALLOWED                                     | Taker == maker                           |
| 8          | pending\_order\_tracker | EMAX\_FIXED\_SIZED\_PENDING\_REQS\_HIT                         | Max fixed-size pending requests exceeded |
| 8          | clearinghouse\_perp     | ENOT\_REDUCE\_ONLY                                             | Not reduce-only when expected            |
| 8          | dex\_accounts           | ESUBACCOUNT\_IS\_NOT\_ACTIVE                                   | Subaccount is inactive                   |
| 10         | perp\_market\_config    | EINVALID\_PRICE                                                | Price == 0                               |
| 10         | pending\_order\_tracker | EINVALID\_TP\_SL\_SIZE                                         | Invalid TP/SL size                       |
| 11         | perp\_market\_config    | EINVALID\_SIZE                                                 | Size == 0                                |
| 12         | perp\_market\_config    | EORDER\_SIZE\_TOO\_LARGE                                       | Price × size too large                   |

## cancel\_client\_order\_to\_subaccount

| Error Code | Module                  | Error Name                         | When It Occurs                                                                  |
| ---------- | ----------------------- | ---------------------------------- | ------------------------------------------------------------------------------- |
| 2          | pending\_order\_tracker | E\_MARKET\_NOT\_FOUND              | Market not found in account's pending orders                                    |
| 3          | pending\_order\_tracker | E\_INVALID\_ORDER\_CLEANUP\_SIZE   | Invalid order cleanup size (size mismatch or price×size mismatch)               |
| 4          | perp\_engine            | EMARKET\_HALTED                    | Exchange is not open                                                            |
| 5          | async\_matching\_engine | EINVALD\_WORK\_UNITS\_PER\_TRIGGER | Invalid work units (should not occur with DEFAULT\_WORK\_UNITS\_PER\_TRIGGER=5) |

## place\_bulk\_orders\_to\_subaccount

| Error Code | Module                  | Error Name                                                     | When It Occurs                                                   |
| ---------- | ----------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------- |
| 1          | clearinghouse\_perp     | EINVALID\_ARGUMENT                                             | Prices/sizes length mismatch in get\_effective\_price\_and\_size |
| 3          | clearinghouse\_perp     | EINVALID\_SIZE\_IS\_TOO\_LARGE                                 | Total size exceeds I64\_MAX                                      |
| 3          | dex\_accounts           | ENOT\_SUBACCOUNT\_OWNER\_OR\_LACKS\_PERP\_TRADING\_PERMISSIONS | Signer lacks trading permissions                                 |
| 4          | perp\_market\_config    | ESIZE\_NOT\_RESPECTING\_MIN\_SIZE                              | Any size \< min\_size                                            |
| 4          | perp\_engine            | EMARKET\_HALTED                                                | Exchange is not open                                             |
| 5          | clearinghouse\_perp     | EINVALID\_PRICE\_IS\_TOO\_LARGE                                | Effective price exceeds I64\_MAX                                 |
| 5          | async\_matching\_engine | EINVALD\_WORK\_UNITS\_PER\_TRIGGER                             | Invalid work units                                               |
| 6          | perp\_market\_config    | EPRICE\_NOT\_RESPECTING\_TICKER\_SIZE                          | Any price not multiple of ticker\_size                           |
| 8          | dex\_accounts           | ESUBACCOUNT\_IS\_NOT\_ACTIVE                                   | Subaccount is inactive                                           |
| 10         | perp\_market\_config    | EINVALID\_PRICE                                                | Any price == 0                                                   |
| 11         | perp\_market\_config    | EINVALID\_SIZE                                                 | Any size == 0                                                    |
| 12         | perp\_market\_config    | EORDER\_SIZE\_TOO\_LARGE                                       | Any price × size too large                                       |
| 13         | perp\_market\_config    | EPRICE\_SIZES\_LENGTH\_MISMATCH                                | Prices length != sizes length                                    |

## cancel\_bulk\_order\_to\_subaccount

| Error Code | Module        | Error Name                                                     | When It Occurs                   |
| ---------- | ------------- | -------------------------------------------------------------- | -------------------------------- |
| 3          | dex\_accounts | ENOT\_SUBACCOUNT\_OWNER\_OR\_LACKS\_PERP\_TRADING\_PERMISSIONS | Signer lacks trading permissions |
| 4          | perp\_engine  | EMARKET\_HALTED                                                | Exchange is not open             |
| 8          | dex\_accounts | ESUBACCOUNT\_IS\_NOT\_ACTIVE                                   | Subaccount is inactive           |
