> For the complete documentation index, see [llms.txt](https://titan-exchange.gitbook.io/titan/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://titan-exchange.gitbook.io/titan/developer-doc/searchers-limit-orders/error-codes.md).

# Error Codes

**These are the custom error codes thrown by the Titan Limit Order program.** Each maps to a specific on-chain validation failure.

```rust
#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum LimitOrderError {
    InvalidOrderStatus,                   // 0
    InvalidAmount,                        // 1
    InvalidMaker,                         // 2
    InvalidMint,                          // 3
    InvalidPrice,                         // 4
    InvalidTokenAccountAuthority,         // 5
    InvalidTokenProgramId,                // 6
    InvalidAssociatedTokenAccountAddress, // 7
    InvalidExtension,                     // 8
    EventDeserializationError,            // 9
    ExpirationSlotExceeded,               // 10
    ExecutionTimeInForceViolation,        // 11
    MaxCostLimitExceeded,                 // 12
    OrderNotExpired,                      // 13
}
```

* **`0` — `InvalidOrderStatus`** — Order is not in a valid state for this operation. Check the order's [status](/titan/developer-doc/searchers-limit-orders/overview.md#order-status) before interacting.
* **`1` — `InvalidAmount`** — Amount is zero or exceeds the remaining balance.
* **`2` — `InvalidMaker`** — Maker public key does not match the order.
* **`3` — `InvalidMint`** — Token mint does not match the order's input or output mint.
* **`4` — `InvalidPrice`** — Price parameters are invalid (e.g. zero `price_base`).
* **`5` — `InvalidTokenAccountAuthority`** — Token account authority does not match the expected owner.
* **`6` — `InvalidTokenProgramId`** — Wrong token program passed for the mint. **Use SPL Token for SPL mints, SPL Token-2022 for Token-2022 mints.**
* **`7` — `InvalidAssociatedTokenAccountAddress`** — ATA address does not match the expected derivation.
* **`8` — `InvalidExtension`** — Token extension is not supported by the program.
* **`9` — `EventDeserializationError`** — Failed to deserialize event data.
* **`10` — `ExpirationSlotExceeded`** — Order has expired. **Cannot be filled after the `expiration_slot`.**
* **`11` — `ExecutionTimeInForceViolation`** — Take violates the order's [time-in-force](/titan/developer-doc/searchers-limit-orders/overview.md#time-in-force) policy. For example, attempting a partial fill on an `AllOrNothing` order.
* **`12` — `MaxCostLimitExceeded`** — Cost exceeds the taker's `max_cost_amount`. Increase the limit or reduce the take amount.
* **`13` — `OrderNotExpired`** — Attempted to close an order that has not yet expired. Wait until `expiration_slot` is reached.

***

## Related pages

* [Limit Orders Overview](/titan/developer-doc/searchers-limit-orders/overview.md) — Order structure, time-in-force, order status
* [Placing Taker Orders](/titan/developer-doc/searchers-limit-orders/take-order.md) — TakeOrder instruction and execution code
* [Limit Order Events](/titan/developer-doc/searchers-limit-orders/events.md) — Event structure and parsing from program logs
