Troubleshooting Errors

Error Codes

In order to reduce gas usage and code size, aave contracts return numbered errors. If you are making calls to the protocol and receive numbered errors, you can use the reference below to know what is the error. Alternatively, you can also find what the numbers represent by checking the Errors.sol

Reference Guide

ValidationLogic and LendingPoolCollateralManager return some collateral related errors. Return type uint
ERROR CODE (uint)
ERROR DESCRIPTION
0
No Error
1
No Collateral available
2
Collateral cannot be liquidated
3
Currency not borrowed
4
Health factor above threshold
5
Not enough liquidity
6
Health factor lower than liquidation threshold
7
Invalid equal assets to swap
8
Frozen reserve
Other error codes returned as string:
ERROR CODE (string)
ORIGINATOR
ERROR DESCRIPTION
1
ValidationLogic
Amount must be greater than 0
2
ValidationLogic
Action requires an active reserve
3
ValidationLogic
Action cannot be performed because the reserve is frozen
4
ValidationLogic
The current liquidity is not enough
5
ValidationLogic
User cannot withdraw more than the available balance
6
ValidationLogic
Transfer cannot be allowed
7
ValidationLogic
Borrowing is not enabled
8
ValidationLogic
Invalid interest rate mode selected
9
ValidationLogic
Collateral balance is 0
10
ValidationLogic
Health factor is lesser than the liquidation threshold
11
ValidationLogic
There is not enough collateral to cover a new borrow
12
ValidationLogic
Stable borrowing not enabled
13
ValidationLogic
Collateral is same currency that is being borrowed
14
ValidationLogic
The requested amount is greater than the max loan size in stable rate mode
15
ValidationLogic
No debt of selected type
16
ValidationLogic
To repay on behalf of a user an explicit amount to repay is needed
17
ValidationLogic
User does not have a stable rate loan in this reserve
18
ValidationLogic
User does not have a variable rate loan in this reserve
19
ValidationLogic
Underlying balance needs to be greater than 0

Debugging transactions on mainnet / Kovan

If your contracts are successfully deployed on a public network, then you can use the very useful service Tenderly.
Tenderly allows you to debug transactions, just like you would on a local instance, using their powerful tools. If your transaction has reverted, try using their debugger to find the line of code where your transaction failed.

Debugging transactions in Truffle

If you have an instance of Truffle running (e.g. console or develop), then you can debug specific transactions using debug YOUR_TX_HASH into your Truffle instance. For more information, see the ez-flashloan starter template README.MD.

EVM revert SafeERC20: low-level call failed

This error indicates that a call to the SafeERC20 implementation of a function has failed. In production, you want to keep using these SafeERC20 implementations.
However in testing, you may want more precise EVM error messages by removing the SafeERC20 implementations. You can do this by replacing the SafeERC20 calls with standard ERC20 calls. For example, in the ez-flashloan starter template, replace the following:
IERC20(_reserve).safeTransfer(_destination, _amount);
with:
IERC20(_reserve).transfer(_destination, _amount);
You will then receive standard EVM error messages if it reverts on this line, which can sometimes be more helpful for debugging purposes.

Web3 error: nonce too low

This error is usually due to the nonce that is being used by your web3 wallet, when creating a transaction to send. It means that the nonce being used is not correct, as the Ethereum node your wallet is communicating with indicates that there is a more recent transaction (with a higher nonce). Here is a good overview of nonces in Ethereum transactions.
Some potential solutions:
  • If using a web3 wallet such as MetaMask: Go to your MetaMask settings --> Advanced --> Reset Account. This will reset the transaction history stored in your local browser cache, including the nonce count. The next transaction you send will use the most recent nonce from the Ethereum node your wallet is connected to.
  • If the error is not coming from your web3 wallet, then it may be due to the Ethereum node it is connected to. For services such as Infura, their network consist of many servers, where a previously submitted transaction may not be present on the server you are currently connected to. In these cases, wait a few minutes, then try again.