# Contract errors

This section contains selected, most frequently occurring errors the protocol may revert with.

## Router

### swap: EXPIRED

Thrown when the current block's timestamp is greater than the provided `_deadline` of a swap.

```solidity
require(block.timestamp <= _deadline, "RC:_swapExactTokensForTokens:EXPIRED");
```

### swap: BELOW\_MINIMUM

Thrown when the minimum acceptable output amount `_amountOutMin` of a swap is not met.

```solidity
require(amountOut >= _amountOutMin, "RC:_swapExactTokensForTokens:BELOW_MINIMUM");
```

***

## SwapPool

### withdraw: MINIMUM\_AMOUNT

Thrown when the withdraw amount `_payoutAmount` is less than the accepted minimum amount `_minimumAmount`.

```solidity
require(payoutAmount_ >= _minimumAmount, "SP:withdraw:MINIMUM_AMOUNT");
```

### backstopBurn: TIMELOCK

Thrown when the user `_owner` attempts to execute a `backstopBurn` in the same block as their last deposit, and the shares to burn exceed the balance held before that deposit.

```solidity
if (block.number == lastDepositAt[_owner]) {
    require(userBalance - lastDepositAmount[_owner] >= _sharesToBurn, "SP:backstopBurn:TIMELOCK");
}
```

### backstopBurn: INSUFFICIENT\_COVERAGE

Thrown when the coverage ratio of the swap pool is more or would still be greater than 100% for the amount of swap pool LP shares to be redeemed for backstop pool liquidity.

```solidity
require(oldReserve <= oldTotalLiabilities - amount_, "SP:backstopBurn:INSUFFICIENT_COVERAGE");
```

### backstopDrain: INSUFFICIENT\_COVERAGE

Thrown when the coverage ratio of the swap pool is less or would become lower than 100% for the amount of backstop pool LP shares to be withdrawn for swap pool liquidity.

```solidity
require(oldReserve >= oldTotalLiabilities + _amount, "SP:backstopDrain:INSUFFICIENT_COVERAGE");
```

### swap: EXCEEDS\_MAX\_COVERAGE\_RATIO

Thrown when the coverage ratio of the swap pool would exceed 200% after swap inequire(

```solidity
require(
    (oldReserve + effectiveAmount_) <= (maxCoverageRatioForSwapIn * oldTotalLiabilities) / 100,
    "SP:quoteSwapInto:EXCEEDS_MAX_COVERAGE_RATIO"
 );
```

***

## BackstopPool

### withdraw: MINIMUM\_AMOUNT

Thrown when the withdraw amount `_payoutAmount` is less than the accepted minimum amount `_minimumAmount`.

```solidity
require(payoutAmount_ >= _minimumAmount, "BC:finalizeWithdrawBackstopLiquidity:MINIMUM_AMOUNT");
```

### redeemSwapPoolShares: MIN\_AMOUNT

Thrown when the amount of the to be withdrawn backstop pool LP shares for swap pool liquidity is less the accepted minimum amount `_minAmount`.

```solidity
require(amountOut_ >= _minAmountOut, "BC:_redeemSwapPoolShares:MIN_AMOUNT");
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nabla.fi/developers/contract-errors.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
