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

# Error Codes

# Custom Errors (Errors.sol)

The protocol uses a centralized `Errors` library for custom error definitions across all contracts.

## Voter Errors

| Error                  | Parameters                      | Description                                          |
| ---------------------- | ------------------------------- | ---------------------------------------------------- |
| `ACTIVE_GAUGE`         | `address gauge`                 | Attempting to interact with an already active gauge  |
| `GAUGE_INACTIVE`       | `address gauge`                 | Attempting to interact with an inactive gauge        |
| `ALREADY_WHITELISTED`  | `address token`                 | Attempting to whitelist an already whitelisted token |
| `NOT_AUTHORIZED`       | `address caller`                | Caller is not authorized to perform the action       |
| `NOT_WHITELISTED`      | `address token`                 | Token is not whitelisted                             |
| `BOTH_NOT_WHITELISTED` | —                               | Both tokens in a pair are not whitelisted            |
| `NOT_POOL`             | `address pool`                  | Address is not a valid pool                          |
| `NOT_INIT`             | —                               | Contract is not initialized                          |
| `LENGTH_MISMATCH`      | —                               | Array lengths don't match                            |
| `NO_GAUGE`             | `address pool`                  | Pool doesn't have an associated gauge                |
| `ALREADY_DISTRIBUTED`  | `address gauge, uint256 period` | Rewards are already distributed for the period       |
| `ZERO_VOTE`            | `address pool`                  | Attempting to vote with zero amount                  |
| `RATIO_TOO_HIGH`       | `uint256 _xRatio`               | Ratio exceeds maximum allowed                        |
| `VOTE_UNSUCCESSFUL`    | —                               | Vote operation failed                                |

## Gauge V3 Errors

| Error                    | Parameters       | Description                                                           |
| ------------------------ | ---------------- | --------------------------------------------------------------------- |
| `GAUGE_EXISTS`           | `address pool`   | Pool already has a gauge                                              |
| `NOT_VOTER`              | `address caller` | Caller is not the voter contract                                      |
| `NOT_GT_ZERO`            | `uint256 amt`    | Amount is not greater than zero                                       |
| `CANT_CLAIM_FUTURE`      | —                | Attempting to claim future rewards                                    |
| `CANT_REWARD_PAST`       | —                | Attempting to reward past periods                                     |
| `NEED_TEAM_TO_UPDATE`    | —                | Gauge can't determine if using `secondsInRange` from the pool is safe |
| `NOT_AUTHORIZED_CLAIMER` | `address owner`  | Owner is not an authorized NFP manager                                |

## Gauge Errors

| Error                        | Parameters                          | Description                      |
| ---------------------------- | ----------------------------------- | -------------------------------- |
| `ZERO_AMOUNT`                | —                                   | Amount is zero                   |
| `CANT_NOTIFY_STAKE`          | —                                   | Stake notification failed        |
| `REWARD_TOO_HIGH`            | —                                   | Reward amount is too high        |
| `NOT_GREATER_THAN_REMAINING` | `uint256 amount, uint256 remaining` | Amount exceeds remaining balance |
| `TOKEN_ERROR`                | `address token`                     | Token operation failed           |
| `NOT_NFP_MANAGER`            | `address nfpManager`                | Address is not an NfpManager     |

## Fee Distributor Errors

| Error                          | Parameters            | Description                                                      |
| ------------------------------ | --------------------- | ---------------------------------------------------------------- |
| `NOT_FINALIZED`                | `uint256 period`      | Period is not finalized                                          |
| `NOT_FEE_DISTRIBUTOR`          | `address destination` | Redirect destination is not a FeeDistributor                     |
| `DIFFERENT_DESTINATION_TOKENS` | —                     | Redirect destination's pool/pair has completely different tokens |

## Pair Errors

| Error                           | Parameters | Description                   |
| ------------------------------- | ---------- | ----------------------------- |
| `UNSTABLE_RATIO`                | —          | Ratio is unstable             |
| `SAFE_TRANSFER_FAILED`          | —          | Safe transfer failed          |
| `OVERFLOW`                      | —          | Arithmetic overflow           |
| `SKIM_DISABLED`                 | —          | Skim operation is disabled    |
| `INSUFFICIENT_LIQUIDITY_MINTED` | —          | Insufficient liquidity minted |
| `INSUFFICIENT_LIQUIDITY_BURNED` | —          | Insufficient liquidity burned |
| `INSUFFICIENT_OUTPUT_AMOUNT`    | —          | Output amount is insufficient |
| `INSUFFICIENT_INPUT_AMOUNT`     | —          | Input amount is insufficient  |
| `INSUFFICIENT_LIQUIDITY`        | —          | Insufficient liquidity        |
| `INVALID_TRANSFER`              | —          | Invalid transfer              |
| `K`                             | —          | K invariant violation in AMM  |

## Pair Factory Errors

| Error                | Parameters | Description                 |
| -------------------- | ---------- | --------------------------- |
| `FEE_TOO_HIGH`       | —          | Fee is too high             |
| `ZERO_FEE`           | —          | Fee is zero                 |
| `INVALID_ASSORTMENT` | —          | Token assortment is invalid |
| `ZERO_ADDRESS`       | —          | Address is zero             |
| `PAIR_EXISTS`        | —          | Pair already exists         |
| `INVALID_FEE_SPLIT`  | —          | Fee split is invalid        |

## Fee Recipient Factory Errors

| Error                  | Parameters | Description             |
| ---------------------- | ---------- | ----------------------- |
| `INVALID_TREASURY_FEE` | —          | Treasury fee is invalid |

## Router Errors

| Error                    | Parameters | Description                    |
| ------------------------ | ---------- | ------------------------------ |
| `EXPIRED`                | —          | Deadline has expired           |
| `IDENTICAL`              | —          | Tokens are identical           |
| `INSUFFICIENT_AMOUNT`    | —          | Amount is insufficient         |
| `INVALID_PATH`           | —          | Path is invalid                |
| `INSUFFICIENT_B_AMOUNT`  | —          | Token B amount is insufficient |
| `INSUFFICIENT_A_AMOUNT`  | —          | Token A amount is insufficient |
| `EXCESSIVE_INPUT_AMOUNT` | —          | Input amount is excessive      |
| `ETH_TRANSFER_FAILED`    | —          | ETH transfer failed            |
| `INVALID_RESERVES`       | —          | Reserves are invalid           |

## Minter Errors

| Error                            | Parameters | Description                                               |
| -------------------------------- | ---------- | --------------------------------------------------------- |
| `STARTED`                        | —          | Epoch 0 has already started                               |
| `EMISSIONS_NOT_STARTED`          | —          | Emissions haven't started                                 |
| `TOO_HIGH`                       | —          | Deviation is too high                                     |
| `NO_CHANGE`                      | —          | No value change detected                                  |
| `SAME_PERIOD`                    | —          | Updating emissions in same period                         |
| `INVALID_CONTRACT`               | —          | Contract setup is invalid                                 |
| `FEE_SPLIT_WHEN_NO_GAUGE_IS_OFF` | —          | Legacy factory doesn't have `feeSplitWhenNoGauge` enabled |

## Access Hub Errors

| Error                      | Parameters       | Description                               |
| -------------------------- | ---------------- | ----------------------------------------- |
| `SAME_ADDRESS`             | —                | Addresses are identical                   |
| `NOT_TIMELOCK`             | `address caller` | Caller is not the timelock                |
| `MANUAL_EXECUTION_FAILURE` | `bytes reason`   | Manual execution failed                   |
| `KICK_FORBIDDEN`           | `address target` | Kick operation is forbidden               |
| `FUNCTION_NOT_FOUND`       | —                | Function called on AccessHub is not found |
| `FAILED_TO_ADD`            | —                | Expansion pack can't be added             |
| `FAILED_TO_REMOVE`         | —                | Expansion pack can't be removed           |
| `NOT_X33_ADAPTER`          | —                | Caller is not the x33Adapter              |

## Vote Module Errors

| Error             | Parameters | Description                     |
| ----------------- | ---------- | ------------------------------- |
| `NOT_XRAM`        | —          | Caller is not xRAM              |
| `COOLDOWN_ACTIVE` | —          | Cooldown period is still active |
| `NOT_VOTEMODULE`  | —          | Caller is not the vote module   |
| `UNAUTHORIZED`    | —          | Caller is unauthorized          |
| `NOT_ACCESSHUB`   | —          | Caller is not the access hub    |
| `INVALID_ADDRESS` | —          | Address is invalid              |

## x33 Errors

| Error                        | Parameters           | Description                    |
| ---------------------------- | -------------------- | ------------------------------ |
| `ZERO`                       | —                    | Value is zero                  |
| `NOT_ENOUGH`                 | —                    | Amount is insufficient         |
| `NOT_CONFORMED_TO_SCALE`     | `uint256 value`      | Value doesn't conform to scale |
| `LOCKED`                     | —                    | Contract is locked             |
| `REBASE_IN_PROGRESS`         | —                    | Rebase is in progress          |
| `AGGREGATOR_REVERTED`        | `bytes reason`       | Aggregator reverted            |
| `AMOUNT_OUT_TOO_LOW`         | `uint256 amount`     | Output amount is too low       |
| `AGGREGATOR_NOT_WHITELISTED` | `address aggregator` | Aggregator is not whitelisted  |
| `FORBIDDEN_TOKEN`            | `address token`      | Token is forbidden             |

## xRAM Errors

| Error            | Parameters | Description                     |
| ---------------- | ---------- | ------------------------------- |
| `NOT_MINTER`     | —          | Caller is not the minter        |
| `NO_VEST`        | —          | No vest exists                  |
| `ALREADY_EXEMPT` | —          | Already exempt                  |
| `NOT_EXEMPT`     | —          | Not exempt                      |
| `CANT_RESCUE`    | —          | Rescue operation is not allowed |
| `ARRAY_LENGTHS`  | —          | Array lengths mismatch          |
| `VEST_OVERLAP`   | —          | Vesting periods overlap         |

## V3 Factory Errors

| Error              | Parameters    | Description            |
| ------------------ | ------------- | ---------------------- |
| `IDENTICAL_TOKENS` | —             | Tokens are identical   |
| `FEE_TOO_LARGE`    | —             | Fee is too large       |
| `ADDRESS_ZERO`     | —             | Address is zero        |
| `F0`               | —             | Fee is zero            |
| `OOB`              | `uint8 value` | Value is out of bounds |

***

# CL Pool String Errors

Short string error codes used in the concentrated liquidity pool contracts.

## Oracle.sol

* `OLD`: The target must be chronologically after the oldest observation
* `I`: The pool has not been initialized

## Position.sol

* `NP`: Burn cannot be called for a position with 0 liquidity

## Tick.sol

* `LO`: LiquidityGrossAfter must be less than MaxLiquidity

## TickMath.sol

* `T`: The given tick must be less than, or equal to, the maximum tick
* `R`: Second inequality must be \< because the price can never reach the price at the max tick

## TransferHelper.sol

* `TF`: Transfer failed

## RamsesV3Pool.sol

* `LOK`: Reentrancy guard — a transaction cannot re-enter the pool mid-swap
* `TLU`: The lower tick must be below the upper tick
* `TLM`: The lower tick must be greater than, or equal to, the minimum tick
* `TUM`: The upper tick must be less than, or equal to, the maximum tick
* `AI`: The pool is already initialized
* `M0`: The balance of token0 before minting must be less than or equal to the balance after minting
* `M1`: The balance of token1 before minting must be less than or equal to the balance after minting
* `AS`: `amountSpecified` cannot be zero
* `SPL`: Square root price limit violated
* `IIA`: Insufficient input amount — not enough tokens sent during the callback
* `L`: Liquidity must be greater than zero for a flash to be executed
* `F0`: The balance of token0 before flash must be less than or equal to the balance after flash plus the fee
* `F1`: The balance of token1 before flash must be less than or equal to the balance after flash plus the fee
