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

# Error Codes

> Understanding and resolving error codes

<Warning>
  Kalshi's clearinghouse has a weekly maintenance window on **Thursdays from
  3:00 AM to 5:00 AM ET**. Orders submitted during this window will not be
  cleared. The order will be reverted.
  Your application should prevent users from submitting orders during this
  window.
</Warning>

## General HTTP errors

| Code | Title               | When it happens                     | How to fix                                                                         |
| ---- | ------------------- | ----------------------------------- | ---------------------------------------------------------------------------------- |
| 429  | Rate limit exceeded | Too many requests in a short window | Retry with backoff, reduce request rate, or use an [API key](/get-started/api-key) |

## Trading API

### `route_not_found`

This error is most common in three situations:

1. **Wrong `outputMint` for prediction markets.** If you are selling an outcome
   token, `outputMint` must match the market's settlement mint. We currently
   support two settlement mints:

   * USDC: `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`
   * CASH: `CASHx9KJUStyftLFWGvEVf59SGeG9sh5FfcnZMVPCASH`

   You can resolve this by using the settlement
   mint listed in the market's `accounts` object.

2. **Incorrect `amount` units.** The `amount` parameter is the `inputMint`
   amount in atomic units (scaled by decimals). If you pass standard
   (human-readable) units (for example `8` instead of `8_000_000`), the router will not find a viable route.

3. **No liquidity at the top of book.** For outcome tokens, `route_not_found`
   can mean there is no available bid/ask on the side the user wants to trade.

   **How to check**

   * Get the market for the outcome token:
     * `GET https://dev-prediction-markets-api.dflow.net/api/v1/market/by-mint/{outcome_mint}` (See [Metadata API](/resources/metadata-api/markets/market-by-mint))
     * Use your production Metadata API base URL in production.
   * See which side the user is on:
     * In the response, open the `accounts` object and find the entry whose
       `yesMint` or `noMint` equals the outcome mint.
     * If it matches `yesMint`, they are trading the YES outcome.
     * If it matches `noMint`, they are trading the NO outcome.
   * Check the right bid or ask using the top-level fields from the same market response:
     * Selling YES → check `yesBid`. If it is `null` (or empty), there is no one to buy.
     * Selling NO → check `noBid`. If it is `null` (or empty), there is no one to buy.
     * Buying YES → check `yesAsk`. If it is `null` (or empty), no one is offering YES.
     * Buying NO → check `noAsk`. If it is `null` (or empty), no one is offering NO.

### `price_impact_too_high`

The effective price during routing is worse than the allowed threshold. If unspecified, the server determines the default. To set your own threshold, pass [`priceImpactTolerancePct`](/resources/trading-api/order/order#parameter-price-impact-tolerance-pct).

## Prediction Markets IDL

| Code | Name                    | Message                              |
| ---- | ----------------------- | ------------------------------------ |
| 16   | MarketNotOpen           | Market is not open                   |
| 17   | MarketOutcomeDetermined | Market outcome is already determined |
| 18   | MarketNotDetermined     | Market is not determined             |
| 19   | InvalidMarketStatus     | Invalid market status                |
| 64   | InvalidQuantity         | Invalid quantity                     |
| 80   | OrderAlreadyFilled      | Order already filled                 |
| 81   | InvalidFillQuantity     | Invalid fill quantity                |
| 82   | InvalidMarketOutcome    | Invalid market outcome               |
| 83   | FillUnderproduced       | Produced output \< min output amount |
| 84   | FillOverconsumed        | Consumed input > max input amount    |
| 96   | Underflow               | Underflow                            |
| 97   | Overflow                | Overflow                             |
| 255  | Unknown                 | Unknown error                        |
