> For the complete documentation index, see [llms.txt](https://docs.agilefi.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agilefi.org/atokens/error-codes.md).

# Error Codes

| Code | Name                             | Description                                                                                                                                                                    |
| ---- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 0    | `NO_ERROR`                       | Not a failure.                                                                                                                                                                 |
| 1    | `UNAUTHORIZED`                   | The sender is not authorized to perform this action.                                                                                                                           |
| 2    | `BAD_INPUT`                      | An invalid argument was supplied by the caller.                                                                                                                                |
| 3    | `COMPTROLLER_REJECTION`          | The action would violate the comptroller policy.                                                                                                                               |
| 4    | `COMPTROLLER_CALCULATION_ERROR`  | An internal calculation has failed in the comptroller.                                                                                                                         |
| 5    | `INTEREST_RATE_MODEL_ERROR`      | The interest rate model returned an invalid value.                                                                                                                             |
| 6    | `INVALID_ACCOUNT_PAIR`           | The specified combination of accounts is invalid.                                                                                                                              |
| 7    | `INVALID_CLOSE_AMOUNT_REQUESTED` | The amount to liquidate is invalid.                                                                                                                                            |
| 8    | `INVALID_COLLATERAL_FACTOR`      | The collateral factor is invalid.                                                                                                                                              |
| 9    | `MATH_ERROR`                     | A math calculation error occurred.                                                                                                                                             |
| 10   | `MARKET_NOT_FRESH`               | Interest has not been properly accrued.                                                                                                                                        |
| 11   | `MARKET_NOT_LISTED`              | The market is not currently listed by its comptroller.                                                                                                                         |
| 12   | `TOKEN_INSUFFICIENT_ALLOWANCE`   | ERC-20 contract must *allow* Money Market contract to call transferFrom. The current allowance is either 0 or less than the requested supply, repayBorrow or liquidate amount. |
| 13   | `TOKEN_INSUFFICIENT_BALANCE`     | Caller does not have sufficient balance in the ERC-20 contract to complete the desired action.                                                                                 |
| 14   | `TOKEN_INSUFFICIENT_CASH`        | The market does not have a sufficient cash balance to complete the transaction. You may attempt this transaction again later.                                                  |
| 15   | `TOKEN_TRANSFER_IN_FAILED`       | Failure in ERC-20 when transfering token into the market.                                                                                                                      |
| 16   | `TOKEN_TRANSFER_OUT_FAILED`      | Failure in ERC-20 when transfering token out of the market.                                                                                                                    |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.agilefi.org/atokens/error-codes.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.
