> For the complete documentation index, see [llms.txt](https://docs.zestprotocol.com/start/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zestprotocol.com/start/stacks-vaults-smart-contracts/zvstbtc-error-codes.md).

# zvstBTC Error Codes

When a vault transaction fails, it returns an error code that tells you why. Each contract uses its own numeric range, so the first digits identify which contract raised the error:

* `u850xxx`: the zvstBTC share token
* `u860xxx`: the state contract
* `u870xxx`: the engine
* `u880xxx`: the operator

## Share Token (u850xxx)

| Code      | Name               | Meaning                                                                                                  |
| --------- | ------------------ | -------------------------------------------------------------------------------------------------------- |
| `u850001` | ERR-NOT-AUTHORIZED | The caller is not allowed to perform this action (for example, only the engine can mint or burn shares). |

## State Contract (u860xxx)

| Code      | Name                       | Meaning                                                         |
| --------- | -------------------------- | --------------------------------------------------------------- |
| `u860001` | ERR-NOT-AUTHORIZED         | The caller does not hold the role required for this action.     |
| `u860002` | ERR-NO-CLAIM               | The referenced withdrawal claim does not exist.                 |
| `u860003` | ERR-TIMELOCK-NOT-READY     | A timelocked change was confirmed before its delay had elapsed. |
| `u860004` | ERR-NO-PENDING-UPDATE      | There is no pending change to confirm.                          |
| `u860005` | ERR-INVALID-KEY            | The configuration key being updated is not valid.               |
| `u860006` | ERR-WRONG-TOKEN            | The token passed does not match the vault's expected asset.     |
| `u860007` | ERR-INSUFFICIENT-LIQUIDITY | The vault does not hold enough idle balance for this action.    |

## Engine (u870xxx)

| Code      | Name                      | Meaning                                                                                       |
| --------- | ------------------------- | --------------------------------------------------------------------------------------------- |
| `u870001` | ERR-PAUSED                | The vault, deposits, or withdrawals are paused.                                               |
| `u870002` | ERR-CAP-EXCEEDED          | The deposit would push net deposits over the deposit cap.                                     |
| `u870003` | ERR-BELOW-MIN             | The amount is below the minimum, or a claim cannot yet be funded from idle balances.          |
| `u870004` | ERR-NO-CLAIM              | The referenced withdrawal claim does not exist.                                               |
| `u870005` | ERR-NOT-COOLED-DOWN       | The cooldown period has not finished yet.                                                     |
| `u870006` | ERR-ALREADY-FUNDED        | The claim is already funded (so it cannot be cancelled), or the vault is already initialized. |
| `u870007` | ERR-NOT-FUNDED            | The claim has not been funded yet, so it cannot be redeemed.                                  |
| `u870008` | ERR-NOT-AUTHORIZED        | The caller is not allowed to perform this action.                                             |
| `u870009` | ERR-CANCEL-EXPRESS        | Express-lane claims cannot be cancelled.                                                      |
| `u870014` | ERR-ZERO-SHARES           | The deposit is too small to mint any shares, or the vault is not initialized.                 |
| `u870015` | ERR-EXPRESS-DISABLED      | The express withdrawal lane is turned off.                                                    |
| `u870016` | ERR-SLIPPAGE              | Fewer shares would be received than the minimum you set.                                      |
| `u870018` | ERR-RATIO-OOB             | The Stacking DAO exchange rate is outside the vault's accepted range.                         |
| `u870019` | ERR-ALREADY-INIT          | The vault has already been initialized.                                                       |
| `u870020` | ERR-UNEXPECTED-COLLATERAL | The market position holds collateral other than the expected zstBTC.                          |

## Operator (u880xxx)

These errors come from the strategy engine and are mainly relevant to the keeper accounts that run it.

| Code      | Name                 | Meaning                                               |
| --------- | -------------------- | ----------------------------------------------------- |
| `u880001` | ERR-NOT-AUTHORIZED   | The caller is not an authorized operator.             |
| `u880002` | ERR-PAUSED           | Strategy activity is paused.                          |
| `u880003` | ERR-TRANSFER-FAILED  | A token transfer during the strategy step failed.     |
| `u880004` | ERR-WRONG-TOKEN      | An unexpected token was passed to a strategy step.    |
| `u880005` | ERR-NOTHING-TO-SWEEP | There is no balance to sweep.                         |
| `u880006` | ERR-BAD-CONVERSION   | A stake or unstake returned an unexpected amount.     |
| `u880007` | ERR-DEBT-REMAINS     | The position still owes debt and cannot be finalized. |
| `u880008` | ERR-OVER-UNSTACK     | The unstake request exceeds the staked balance.       |

## Common Failures for Users

Most day-to-day failures fall into a few buckets:

* **`u870002`** means the vault is at capacity. Try a smaller amount, or wait until the cap is raised or others withdraw.
* **`u870016`** means slippage protection kicked in. Refresh your quote and try again.
* **`u870005`** means your withdrawal is still in its cooldown. Wait until the unlock time.
* **`u870001`** or **`u870015`** mean an action is currently disabled by governance (a pause, or the express lane being off).
