|
| 1 | +import OutOfGasImage from "../assets/engine-out-of-gas.png"; |
| 2 | +import { Callout, DocImage } from "@doc"; |
| 3 | + |
| 4 | +# Troubleshooting |
| 5 | + |
| 6 | +Here are helpful resources for debugging issues when using Engine. |
| 7 | + |
| 8 | +## Sending transactions |
| 9 | + |
| 10 | +### Received "UNPREDICTABLE_GAS_LIMIT" error |
| 11 | + |
| 12 | +**What it means** |
| 13 | + |
| 14 | +The RPC reported that this transaction failed simulation and is expected to fail onchain, and it is being rejected before it is sent. No gas is consumed. This error indicates the contract logic will throw an error (or "revert the execution"). |
| 15 | + |
| 16 | +Common reasons: minting from a token contract that has no claim condition, has not started the minting period, is out of supply, has the incorrect amount paid to it, the calling backend wallet does not have permissions to call the contract. |
| 17 | + |
| 18 | +**How to resolve** |
| 19 | + |
| 20 | +Try to simulate the transaction by passing the `?simulateTx=true` query parameter or using the thirdweb [Transaction Simulator](https://thirdweb.com/tools/transaction-simulator) to reveal the error message. |
| 21 | + |
| 22 | +### The transaction failed onchain |
| 23 | + |
| 24 | +*Also known as: execution reverted* |
| 25 | + |
| 26 | +**What it means** |
| 27 | + |
| 28 | +The transaction passed simulation but the execution was reverted onchain. This can occur if a change in state occurred, such as an NFT contract running out of supply before a transaction was mined. |
| 29 | + |
| 30 | +Another common reason is the transaction ran out of gas. You can verify this by checking the "More Details" section in your blockchain explorer and confirming if the gas usage reached the gas limit: |
| 31 | + |
| 32 | +<DocImage |
| 33 | + src={OutOfGasImage} |
| 34 | + alt="Out of gas" |
| 35 | + className="max-w-[500px] mx-auto" |
| 36 | +/> |
| 37 | + |
| 38 | +**How to resolve** |
| 39 | + |
| 40 | +If the transaction failed due to onchain logic, try to simulate the transaction (see above) to identify the reason. |
| 41 | + |
| 42 | +If the gas limit was reached, you may try [manually overriding the gas settings](https://portal.thirdweb.com/engine/features/contracts#override-gas-settings). Engine automatically estimates the gas limit through simulation, and it is not recommended to override the gas limit unless the estimation is incorrect. |
| 43 | + |
| 44 | +### Received "replacement transaction underpriced" error |
| 45 | + |
| 46 | +*Also known as: REPLACEMENT_UNDERPRICED, already known* |
| 47 | + |
| 48 | +**What it means** |
| 49 | + |
| 50 | +Engine has already submitted this or another transaction with the same nonce. That transaction is in mempool and waiting to be mined by the chain. |
| 51 | + |
| 52 | +Engine automatically manages nonces so this error typically should not occur. |
| 53 | + |
| 54 | +**How to resolve** |
| 55 | + |
| 56 | +It's possible the transactions are not being accepted by the mempool. To remediate this issue, you can retry a transaction, cancel it, or reset all backend wallet nonces. |
| 57 | + |
| 58 | +To retry a transaction, use [`POST /transaction/sync-retry`](https://redocly.github.io/redoc/?url=https://demo.web3api.thirdweb.com/json#tag/Transaction/operation/syncRetry) and provide the `queueId`. You may also provide a higher gas value to increase the likelihood of the transaction being mined. |
| 59 | + |
| 60 | +To cancel a transaction, use [`POST /transaction/cancel`](https://redocly.github.io/redoc/?url=https://demo.web3api.thirdweb.com/json#tag/Transaction/operation/cancel) and provide the `queueId`. |
| 61 | + |
| 62 | + |
| 63 | +<Callout |
| 64 | + title="Resetting the nonce may fail previous transactions" |
| 65 | + variant="warning" |
| 66 | +> |
| 67 | + Transactions that were sent but not yet mined may fail because new transactions will use the same nonce values as previously sent transactions. |
| 68 | +</Callout> |
| 69 | + |
| 70 | +To reset the nonce, use [`POST /backend-wallet/reset-nonce`](https://redocly.github.io/redoc/?url=https://demo.web3api.thirdweb.com/json#tag/Backend-Wallet/operation/resetNonces) to sync the Engine nonce with the onchain value. This step resets all nonce values tracked in Engine, and the next sent transaction will use the next available onchain nonce. |
| 71 | + |
| 72 | +### Received "Insufficient funds for gas * price + value" error |
| 73 | + |
| 74 | +*Also known as: Insufficient funds for intrinsic transaction cost* |
| 75 | + |
| 76 | +**What it means** |
| 77 | + |
| 78 | +Your backend wallet has insufficient funds to complete the transaction. |
| 79 | + |
| 80 | +Note that on EVM blockchains, a transaction must place a *gas fee bid* on a transaction that is higher than the amount that will actually get consumed. This means your wallet must have a minimum amount of gas in order to send transactions. |
| 81 | + |
| 82 | +You can estimate how much gas is needed. Adjust the values to your use case and chain. |
| 83 | +- `gas` ("gas limit"): The unit of gas that a transaction needs to complete. Assume an NFT mint that takes **120,000 gas**. |
| 84 | +- `maxFeePerGas`: The maximum amount of native token to bid, per gas. Assume **50 gwei**. |
| 85 | +- Amount of gas needed = **6,000,000,000,000,000 wei**. Assume the native currency is ETH which has 18 decimals, this equals 0.006 ETH. |
| 86 | + |
| 87 | +Even though the transaction is expected to consume less gas, the transaction will fail unless the wallet holds at least this much native gas currency. |
| 88 | + |
| 89 | +**How to resolve** |
| 90 | + |
| 91 | +Add more funds to your backend wallet. Or wait until the gas fees on the chain are lower and try again. |
0 commit comments