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

# Error Codes

> Error codes returned by the Perpetuals order, margin and leverage routes.

Every Perpetuals error carries `error.slug` and `error.code` next to its human-readable text; the [Error Reference](/latest/error-reference/error-code) describes the shape per transport and the `SYS` codes shared by every route. Perpetuals codes are `PRP`, one route per block: `PRP-01xx` `createOrder`, `PRP-02xx` `cancelOrder`, `PRP-03xx` `modifyOrder`, `PRP-06xx` `rejectOrder`, `PRP-07xx` `updateLeverage`, `PRP-08xx` `updateMargin`, `PRP-09xx` `updateMarginMode`.

## createOrder

| Error Code | Error Slug | Server Status Code | Meaning |
| - | - | - | - |
| **PRP-0100** | **CREATE\_ORDER\_ERROR** | `400`, `500` | A create failure none of the codes below names. |
| **PRP-0101** | **CREATE\_ORDER\_INSUFFICIENT\_BALANCE** | `400` | Available balance does not cover the order's margin. |
| **PRP-0102** | **CREATE\_ORDER\_INVALID\_TRADE** | `400` | A trading rule none of the codes below names, for example a bad price or quantity. |
| **PRP-0103** | **CREATE\_ORDER\_RECEIVE\_WINDOW** | `400` | The order reached the engine after the [receive window](/latest/perps/guides/order-creation#receive-window) and was rejected. |
| **PRP-0104** | **CREATE\_ORDER\_MAX\_OPEN\_ORDERS** | `400` | The [per-market open-orders cap](/latest/perps/guides/rate-limits#maximum-open-orders-per-market) is reached. |
| **PRP-0105** | **CREATE\_ORDER\_BANNED** | `403` | An [order creation ban](/latest/perps/guides/rate-limits#order-creation-ban-cancellation-only) is in force; `retryAfterSec` says for how long. |
| **PRP-0106** | **CREATE\_ORDER\_REDUCE\_ONLY** | `400` | A reduce-only rule: there is no open position, or the quantity exceeds it. |
| **PRP-0107** | **CREATE\_ORDER\_SELF\_TRADE** | `400` | The order would trade against one of your own resting orders. |
| **PRP-0108** | **CREATE\_ORDER\_PRICE\_BAND** | `400` | The price is too far from the mark or index price. |
| **PRP-0109** | **CREATE\_ORDER\_CONFLICT** | `409` | The order's state moved on while the command was in flight. Look the order up before deciding what to do. |

## cancelOrder

| Error Code | Error Slug | Server Status Code | Meaning |
| - | - | - | - |
| **PRP-0200** | **CANCEL\_ORDER\_ERROR** | `400`, `500` | A cancel failure none of the codes below names. |
| **PRP-0201** | **CANCEL\_ORDER\_CONFLICT\_ERROR** | `409` | The cancel lost a race with a fill or another update and was not applied. Send it again as is. |
| **PRP-0202** | **CANCEL\_ORDER\_ALREADY\_CANCELLING** | `409` | Another cancel of the same order is already in flight; its answer follows on this connection. Do not resend. |
| **PRP-0203** | **CANCEL\_ORDER\_NOT\_CANCELLABLE** | `400`, `409` | The order is filled, cancelled, rejected, or a liquidation order. Nothing to cancel. |

## modifyOrder

| Error Code | Error Slug | Server Status Code | Meaning |
| - | - | - | - |
| **PRP-0300** | **MODIFY\_ORDER\_ERROR** | `400`, `500` | A modify failure none of the codes below names. |
| **PRP-0301** | **MODIFY\_ORDER\_INSUFFICIENT\_BALANCE** | `400` | Available balance does not cover the modified order's margin. |
| **PRP-0302** | **MODIFY\_ORDER\_INVALID\_TRADE** | `400` | A trading rule none of the codes below names. |
| **PRP-0303** | **MODIFY\_ORDER\_NOT\_FOUND\_ERROR** | `404` | No order with that id for this account. |
| **PRP-0304** | **MODIFY\_ORDER\_CONFLICT\_ERROR** | `409` | The modify lost a race with another update and was not applied. |
| **PRP-0305** | **MODIFY\_ORDER\_NOT\_ACTIVE** | `400`, `409` | Only an `active` order can be modified. |
| **PRP-0306** | **MODIFY\_ORDER\_RECEIVE\_WINDOW** | `400` | The replacement order reached the engine after the receive window. |
| **PRP-0307** | **MODIFY\_ORDER\_MAX\_OPEN\_ORDERS** | `400` | The replacement order would exceed the per-market open-orders cap. |
| **PRP-0308** | **MODIFY\_ORDER\_REDUCE\_ONLY** | `400` | A reduce-only rule on the replacement order. |
| **PRP-0309** | **MODIFY\_ORDER\_WOULD\_MATCH** | `400` | The modified post-only price would take liquidity. |
| **PRP-0310** | **PARTIAL\_FILL\_ORDER\_ERROR** | `500` | Internal failure while recording a partial fill. |
| **PRP-0311** | **COMPLETE\_FILL\_ORDER\_ERROR** | `500` | Internal failure while recording a complete fill. |
| **PRP-0312** | **MODIFY\_ORDER\_STATE\_CHANGED** | `409` | The original order filled or was cancelled while the modify was in flight. |
| **PRP-0313** | **MODIFY\_ORDER\_SELF\_TRADE** | `400` | The replacement order would trade against one of your own resting orders. |
| **PRP-0314** | **MODIFY\_ORDER\_PRICE\_BAND** | `400` | The modified price is too far from the mark or index price. |

## rejectOrder

Pushed after an order was accepted, on the [Order Creation Stream](/latest/perps/websocket-api/order-creation-stream).

| Error Code | Error Slug | Server Status Code | Meaning |
| - | - | - | - |
| **PRP-0600** | **ORDER\_REJECTED** | `400`, `500` | A rejection none of the codes below names. |
| **PRP-0601** | **ORDER\_REJECTED\_POST\_ONLY** | `400` | A post-only order would have matched immediately and was rejected. |

## updateLeverage

| Error Code | Error Slug | Server Status Code | Meaning |
| - | - | - | - |
| **PRP-0700** | **UPDATE\_LEVERAGE\_ERROR** | `400`, `500` | A leverage update failure none of the codes below names. |
| **PRP-0701** | **UPDATE\_LEVERAGE\_ALREADY\_SET** | `400` | The market already uses the requested leverage. |
| **PRP-0702** | **UPDATE\_LEVERAGE\_NOT\_ALLOWED** | `400` | Open positions or orders in the market forbid the change. |

## updateMargin

| Error Code | Error Slug | Server Status Code | Meaning |
| - | - | - | - |
| **PRP-0800** | **UPDATE\_MARGIN\_ERROR** | `400`, `500` | A margin update failure none of the codes below names. |
| **PRP-0801** | **UPDATE\_MARGIN\_NO\_POSITION** | `400` | No position in the market. |
| **PRP-0802** | **UPDATE\_MARGIN\_NOT\_ISOLATED** | `400` | Margin can only be updated on an isolated-margin position. |
| **PRP-0803** | **UPDATE\_MARGIN\_EXCEEDS\_AVAILABLE** | `400` | The increase exceeds available balance. |
| **PRP-0804** | **UPDATE\_MARGIN\_BELOW\_MINIMUM** | `400` | The decrease would leave less than the minimum required margin. |
| **PRP-0805** | **UPDATE\_MARGIN\_CONFLICT** | `409` | The position's margin was updated by another request in the meantime. Send it again. |

## updateMarginMode

| Error Code | Error Slug | Server Status Code | Meaning |
| - | - | - | - |
| **PRP-0901** | **UPDATE\_MARGIN\_MODE\_MARKET\_IN\_USE** | `400` | Open positions or orders in the market forbid the change. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.