Every DeFi user knows the frustration: you click "Confirm," wait 30 seconds, and watch your transaction fail — burning gas fees with nothing to show for it. Whether it's "out of gas" on Uniswap, "health factor too low" on Aave, or a mysterious custom error on a new protocol, failed transactions cost time, money, and confidence.
This guide gives you a systematic debugging workflow that works across Ethereum, Arbitrum, Optimism, Base, BSC, and Polygon. You'll learn to triage any failure in under 60 seconds using visual decision trees, decode revert reasons without coding, and apply protocol-specific fixes with copy-paste solutions.
Primary keyword placement: This DeFi troubleshooting guide covers the five root cause categories, a six-step debugging workflow, protocol comparison tables, and a quick-reference error code database — everything you need to stop guessing and start fixing.
Why DeFi Transactions Fail — The 5 Root Cause Categories
Every failed transaction traces back to one of five categories. Understanding which bucket your error falls into cuts debugging time in half.
1. Gas & Fee Errors
The problem: Your transaction runs out of computational fuel before completing. On Ethereum L1, this often happens when base fee spikes between estimation and inclusion. On L2s, it's usually an underestimated L1 data fee component.
Common errors:
Out of gas/Gas limit reachedMax fee per gas less than block base fee(EIP-1559)Insufficient maxFeePerGas/Max priority fee too low
The fix: Always apply a 1.3x multiplier to eth_estimateGas results. For complex multicall transactions (router + approve + swap), use 1.5x. On Arbitrum/Optimism, add 200,000 gas for L1 calldata costs.
Pro tip: The estimator runs at block N. Your transaction mines at block N+k. Base fee can change 12.5% per block. A 1.3x buffer covers 95% of volatility scenarios.
2. Liquidity & Slippage Issues
The problem: The market moved against you, or the pool simply doesn't have enough depth for your order size.
Common errors:
SlippageExceeded/PriceImpactTooHighInsufficientLiquidity/AmountOutBelowMinimumTickLower/TickUpper(Uniswap V3 concentrated liquidity)
The fix: Use protocol-specific slippage defaults, not a universal 0.5%:
| Protocol | Pool Type | Recommended Slippage | Why |
|---|---|---|---|
| Uniswap V2/V3 | Volatile pairs | 0.5-1% | Standard AMM |
| Uniswap V3 | Stablecoin (USDC/USDT) | 0.05% | Tight range |
| Curve Finance | Stable pools (3pool, etc.) | 0.01% | StableSwap invariant |
| Curve Finance | Crypto pools (stETH/ETH) | 0.5% | Volatile assets |
| Balancer | Weighted pools | 1% | Multi-token |
| PancakeSwap | BSC volatile | 1-2% | Higher volatility |
Vietnam note: VNDC/USDC pools on Uniswap V3 often need 0.1%+ slippage due to thinner liquidity than major stablecoin pairs.
3. Smart Contract Reverts
The problem: The contract's logic explicitly rejected your transaction. Since Solidity 0.8.4, protocols use custom errors instead of revert strings — cheaper, more informative, but requiring ABI to decode.
Common patterns: `solidity // ERC20 standard errors error InsufficientBalance(uint256 available, uint256 required); error InsufficientAllowance(uint256 available, uint256 required);
// Uniswap V3 error SlippageExceeded(uint256 amountOut, uint256 minAmountOut); error TickLower(int24 tick, int24 tickLower);
// Aave V3 error HealthFactorTooLow(uint256 healthFactor); error ReserveFrozen(uint256 reserveId); `
The fix: Decode the revert data (Step 2 in our workflow). The error name + parameters tell you exactly what to adjust.
4. State & Nonce Problems
The problem: Your transaction's sequence number (nonce) doesn't match what the network expects. This is the silent killer — the error message often says "nonce too low" but the real cause is a stuck earlier transaction.
Common errors:
NonceTooLow/NonceTooHighReplacementTransactionUnderpriced(EIP-1559)TransactionAlreadyInMempool
The fix: Send a 0 ETH self-transfer with the correct nonce. This clears the gap and unsticks the queue. Works identically on Ethereum, Arbitrum, Optimism, Base, BSC, Polygon.
Mobile wallet trap: Coin98, MetaMask Mobile, and Trust Wallet sometimes fail to broadcast the first transaction (poor signal, app backgrounded), but increment the local nonce counter. You then submit tx #2 with nonce N+1 while the network still expects N. Result: permanent stall until you manually reset.
5. Protocol-Specific Guards
The problem: Lending protocols and perpetual DEXs enforce position health checks that have nothing to do with gas or slippage.
| Protocol | Guard Metric | Formula | Liquidation Trigger |
|---|---|---|---|
| Aave V3 | Health Factor (HF) | (Collateral × LiqThreshold) / TotalDebt | HF < 1.0 |
| Compound V3 | Collateral Ratio (CR) | (CollateralValue × CollateralFactor) / BorrowValue | CR < 1.0 |
| GMX | Oracle Price Deviation | markPrice vs oraclePrice | > 2-3% deviation |
| MakerDAO | Collateralization Ratio | CollateralValue / DebtValue | < LiquidationRatio (e.g., 150%) |
Critical insight: Aave HF and Compound CR are inverses. Aave HF = 1.2 = safe. Compound CR = 1.2 = liquidatable (needs > 1). Users confuse these constantly.
DeFi Debugging Workflow — From Failed Tx to Resolution in 6 Steps
Follow this sequence every time. Skip steps at your own risk — and gas expense.
Step 1 — Identify the Error (Get Tx Hash, Check Explorer)
- Copy the transaction hash from your wallet (MetaMask: Activity → Click tx → Copy hash)
- Paste into the correct explorer:
- Ethereum:
etherscan.io/tx/ - Arbitrum:
arbiscan.io/tx/ - Optimism:
optimistic.etherscan.io/tx/ - Base:
basescan.org/tx/ - BSC:
bscscan.com/tx/ - Polygon:
polygonscan.com/tx/ - Check Status: "Fail" / "Reverted" / "Out of Gas"
- Click "Click to see more" → note the Error field (may show raw bytes)
- Check Internal Transactions tab — sometimes the revert happens in a nested call
Step 2 — Decode the Revert Reason (Tenderly, Phalcon, Foundry)
No-code options (recommended for most users):
Tenderly (Free tier: 100 simulations/month)
- Go to
dashboard.tenderly.co→ "Simulate Transaction" - Paste tx hash → "Simulate"
- Click "Debugger" → "Revert Reason" shows human-readable error
- For custom errors: Tenderly auto-fetches ABI from verified contracts
Phalcon Explorer (Free, no login)
- Go to
phalcon.xyz→ paste tx hash - "Call Trace" tab → find red "REVERT" node
- Click → shows decoded error with parameter values
Developer option (Foundry/Cast): `bash
cast run
`
Step 3 — Verify Pre-Conditions (Balances, Allowances, Nonce)
Before resubmitting, confirm the basics:
| Check | Tool | What to Verify |
|---|---|---|
| Token balance | Explorer / cast balance | Sufficient for amount + gas |
| Token allowance | cast call | ≥ transaction amount |
| Native balance | Explorer | ≥ gas limit × maxFeePerGas |
| Nonce | Explorer "Nonce" field / cast nonce | Sequential, no gaps |
| Contract paused? | Explorer contract "Read Contract" → paused() | Not paused |
Step 4 — Simulate the Fix (MANDATORY — Never Skip)
This is the step that saves you 94% of repeat failures.
Tenderly Simulator (UI):
- In Tenderly Debugger, click "Simulate Changes"
- Modify: gas limit (×1.3), slippage, allowance, etc.
- Run simulation → confirm "Success" status
- Copy the exact calldata for resubmission
Phalcon (Explorer-integrated):
- In Phalcon call trace, click "Simulate"
- Adjust parameters in UI
- Re-run → verify success
Foundry Local Fork (Free, unlimited): `bash
anvil --fork-url $RPC_URL --fork-block-number latest
cast send `
Rule: If simulation fails, you know before spending gas. If it succeeds, you have the exact calldata to broadcast. Zero downside.
Step 5 — Apply Resolution (Adjust Parameters, Resubmit)
Based on simulation results, apply the fix:
| Root Cause | Parameter Adjustment |
|---|---|
| Gas estimation | Increase gas limit 30-50% (1.3-1.5×) |
| Slippage | Increase tolerance to protocol default (see table) |
| Allowance | Submit approve(max uint256) first |
| Nonce gap | Send 0 ETH self-tx with correct nonce |
| Health factor | Repay debt OR add collateral |
| Custom error | Fix the specific parameter the error names |
Resubmission: Use your wallet's "Speed Up" / "Cancel" (MetaMask) or broadcast the simulated calldata via cast send --raw .
Step 6 — Verify & Monitor (Confirm On-Chain, Track Position)
- Wait for confirmation (1-3 blocks on L2, 1-5 on Ethereum)
- Verify status = "Success" on explorer
- Check position: DeBank, Zerion, or protocol UI
- For lending: monitor health factor for 24h after volatile moves
- For LP: verify position appears in pool, track impermanent loss
Protocol-Specific Error Handling Comparison
No two protocols handle errors the same way. This comparison saves you from applying Uniswap logic to Aave.
Uniswap V2 / V3
| Aspect | V2 | V3 |
|---|---|---|
| Error format | Revert strings | Custom errors (Solidity 0.8+) |
| Key errors | INSUFFICIENT_LIQUIDITY, EXCESSIVE_SLIPPAGE | SlippageExceeded, TickLower, TickUpper, SqrtPriceLimit |
| Slippage param | amountOutMin (calculated off-chain) | amountOutMinimum + sqrtPriceLimitX96 |
| Debug tool | Tenderly, Etherscan | Tenderly (best ABI support), Phalcon |
| Gas quirk | Simple swap ~150k gas | Multihop + ticks ~250-400k gas |
Uniswap V3 specific: The sqrtPriceLimitX96 parameter protects against sandwich attacks. If you set it too aggressively (e.g., current price ±0.1%), normal volatility triggers SlippageExceeded. Use amountOutMinimum from quoter for standard swaps.
Aave V3
| Error | Meaning | Fix |
|---|---|---|
HealthFactorTooLow | Position undercollateralized | Repay borrow OR supply more collateral |
ReserveFrozen | Asset paused by governance | Wait for unfreeze or use different reserve |
BorrowCapReached | Protocol borrow limit hit | Wait or use different market |
SupplyCapReached | Protocol supply limit hit | Wait or use different market |
InvalidCollateral | Asset not enabled as collateral | Check getReserveConfiguration |
Aave debugging tip: Health factor updates per block. A price oracle update can drop HF from 1.15 → 0.95 in one block. Always maintain HF > 1.2 buffer.
Curve Finance
| Error | Meaning | Fix |
|---|---|---|
InvariantViolation | StableSwap math broke (shouldn't happen) | Report to Curve — likely pool corruption |
BelowMinAmount | Received less than min_amount | Increase slippage tolerance |
AboveMaxAmount | Deposit exceeds pool capacity | Reduce deposit amount |
VirtualPriceDecreased | Pool lost value (rebase/fee) | Accept or wait |
Curve debugging tip: Stable pools (3pool, tricrypto) use amplification coefficient (A). High A = tighter peg = lower slippage tolerance needed. Crypto pools (stETH/ETH) need 0.5%+.
Compound V3 (Comet)
| Error | Meaning | Fix |
|---|---|---|
CollateralRatioTooLow | Position undercollateralized | Repay borrow OR supply more collateral |
BorrowCapReached | Market borrow limit | Wait or different comet |
SupplyCapReached | Market supply limit | Wait or different comet |
PriceOracleStale | Chainlink feed outdated | Wait for oracle update |
Compound debugging tip: Each Comet (market) has unique collateralFactor per asset. USDC might be 85%, WETH 80%, WBTC 70%. Check getAssetInfo(address) before supplying.
GMX (Perpetuals)
| Error | Meaning | Fix |
|---|---|---|
PriceImpactTooHigh | Order moves mark price > threshold | Reduce position size |
OraclePriceDeviation | Mark price vs oracle > 2-3% | Wait for convergence |
FundingRateCap | Funding rate at protocol max | Position auto-closes at cap |
InsufficientMargin | Margin < maintenance | Add collateral or reduce size |
GMX debugging tip: Uses Chainlink + proprietary oracles. During high volatility, oracle deviation protection triggers. Not a bug — a feature preventing bad fills.
Quick Reference — Error Codes & Copy-Paste Solutions
Bookmark this table. When a transaction fails, find the error code → apply the solution.
| Error Code / Message | Protocol(s) | Root Cause | Copy-Paste Solution |
|---|---|---|---|
TRANSFER_FAILED / InsufficientBalance | All ERC20 | Balance < amount OR allowance < amount | cast call → if 0, acquire tokens. cast call → if < amount, cast send |
INSUFFICIENT_LIQUIDITY | Uniswap V2/V3, SushiSwap | Pool reserves depleted for your amount | Reduce swap amount 50%, retry. Or find deeper pool (different fee tier on V3) |
SLIPPAGE_EXCEEDED / SlippageExceeded | All DEXs | Price moved beyond tolerance | Increase slippage: Uniswap 0.5%→1%, Curve 0.01%→0.05%, Balancer 1%→2% |
HEALTH_FACTOR_TOO_LOW / HealthFactorTooLow | Aave V2/V3 | Collateral value dropped or debt increased | Option A: cast send Option B: cast send |
COLLATERAL_RATIO_TOO_LOW / CollateralRatioTooLow | Compound V3 | Collateral value dropped | Same as Aave: repay or supply more. Check getAssetInfo( for collateralFactor |
EXPIRED / Permit2: Expired | Permit2, EIP-2612 | Signature deadline passed | Re-sign with new deadline: deadline = block.timestamp + 3600 (1 hour) |
NONCE_TOO_LOW / NonceTooHigh | All EVM | Stuck earlier transaction | Universal fix: cast send |
OUT_OF_GAS / Out of gas | All | Gas limit too low for execution | Increase gas limit: simple swap 200k→300k, complex multicall 500k→800k |
PRICE_IMPACT_TOO_HIGH | DEXs, GMX | Order size > pool depth | Split into 3-5 smaller orders over 10-15 minutes |
TICK_LOWER / TICK_UPPER | Uniswap V3 | Position range exceeded | Re-mint position with wider range, or accept impermanent loss |
RESERVE_FROZEN | Aave V3 | Asset paused by governance | Check governance forum. Usually temporary (hours-days) |
BORROW_CAP_REACHED | Aave, Compound | Market borrow limit hit | Wait for repayments to free capacity, or use different market |
MIN_AMOUNT_OUT / BelowMinAmount | Curve, Balancer | Slippage protection triggered | Increase min_amount parameter (lower = more tolerant) |
ORACLE_PRICE_DEVIATION | GMX, Synthetix | Mark price diverged from oracle | Wait 1-5 minutes for convergence. Do not force during high vol. |
How to use: Find your error in column 1 → read column 4 → copy the cast command → replace placeholders (, , , ) → run in terminal with RPC URL and private key set.
Prevention Checklist — Avoid Failed Transactions
[ ] Gas estimation: Apply 1.3× buffer (simple), 1.5× (multicall), +200k (L2 calldata) [ ] Slippage: Set per-protocol default (see table in Section 2) [ ] Allowance: Verify allowance ≥ amount before every swap/deposit [ ] Health factor: Maintain Aave HF > 1.2, Compound CR > 1.1 [ ] Nonce: Check explorer for gaps before batch transactions [ ] Simulation: Always simulate complex txs on Tenderly/Phalcon/Foundry first [ ] Timing: Avoid 8-11 AM EST (1-4 PM ICT) for Ethereum mainnet — base fee volatility [ ] Mobile: Don't switch wallets mid-session — nonce counters desync [ ] Approval: Use approve(max uint256) once per token/spender pair [ ] Monitoring: Set alerts (DeBank, Tenderly) for position health factor drops
Vietnam-Specific DeFi Troubleshooting
Vietnam's DeFi users face unique failure patterns due to local on-ramp timing, mobile wallet quirks, and chain preferences.
Momo/ZaloPay Bank Transfer Delays → Nonce Gaps
Scenario: You buy USDT via P2P on Binance/Remitano using Momo. Seller releases after bank confirms (5-15 min). Meanwhile, you've submitted a DeFi transaction from Coin98. The P2P release triggers a token transfer that increments your on-chain nonce. Your DeFi tx (signed earlier with old nonce) now fails with NonceTooLow.
Fix:
- Complete P2P purchase first, wait for on-chain confirmation
- Then submit DeFi transactions
- Or: Use a dedicated DeFi wallet separate from P2P wallet
VNDC/USDC Liquidity on Local DEXs
Problem: Uniswap V3 VNDC/USDC 0.01% fee pool has ~$50k liquidity vs $500M+ for USDC/USDT. A $5,000 swap incurs 2% price impact — far exceeding 0.01% slippage tolerance.
Fix:
- Use 0.5% slippage for VNDC pairs
- Or: Bridge to BSC/Polygon where VNDC liquidity is deeper
- Or: Swap VNDC→USDT on centralized exchange first, then DeFi
Mobile Wallet Gas Estimation Differences
| Wallet | Gas Buffer | L2 Support | Nonce Handling |
|---|---|---|---|
| Coin98 | 1.1× | Basic (Arbitrum, BSC) | Local counter, desyncs on background |
| MetaMask Mobile | 1.5× | Full (all L2s) | Syncs with network on app open |
| Trust Wallet | 1.2× | Basic | Local counter |
| Rainbow | 1.3× | Full | Network-synced |
Recommendation: Use MetaMask Mobile for DeFi (best gas estimation, nonce sync). Use Coin98 for P2P/on-ramp only.
ICT Timezone Gas Patterns
- 8-11 PM ICT (8-11 AM EST): US DeFi users active → Ethereum base fee spikes → gas estimation fails
- 6-9 AM ICT (6-9 PM EST): US evening → moderate activity, stable base fee
- 2-5 AM ICT (2-5 PM EST): US afternoon → lowest base fee, best for large transactions
Strategy: Schedule large DeFi transactions for 2-5 AM ICT. Use 1.5× gas buffer if transacting 8-11 PM ICT.
FAQ
Why did my transaction fail with "out of gas" but the estimator said it was enough?
The estimator runs at block N. Your transaction mines at block N+k where base fee increased. EIP-1559 base fee adjusts 12.5% per block based on utilization. A 1.3× buffer covers 95% of cases. For multicall transactions, use 1.5×.
What's the difference between slippage tolerance and price impact?
Slippage tolerance is your maximum acceptable price movement (set by you). Price impact is the actual price movement your order causes (determined by pool depth). If price impact > slippage tolerance, the transaction reverts. Price impact is unavoidable for large orders; slippage tolerance is your safety setting.
How do I decode a custom error without coding?
Use Phalcon Explorer (free, no login): paste tx hash → Call Trace → click red REVERT node. Or Tenderly (free tier): Simulate Transaction → Debugger → Revert Reason. Both auto-decode verified contract ABIs.
Can I cancel a stuck transaction on Arbitrum/Optimism?
Yes. The 0 ETH self-send with correct nonce works on all EVM chains including Arbitrum, Optimism, Base, BSC, Polygon. On L2s, the sequencer processes it like any other transaction. No special "cancel" function needed.
Why does Aave say "health factor too low" when I have collateral?
Health Factor = (Collateral Value × Liquidation Threshold) / Total Debt. If collateral dropped 10% (price oracle update) or you borrowed more, HF drops below 1.0. Fix: Repay debt OR add collateral. Maintain HF > 1.2 buffer to survive volatility.
What's the safest slippage setting for Curve stablecoin pools?
0.01% for 3pool (USDC/USDT/DAI), 0.05% for other stable pools. Curve's StableSwap invariant keeps prices extremely tight. Higher slippage exposes you to sandwich attacks. Only increase if BelowMinAmount error persists — then check if pool is imbalanced (one token >50% share).
Tools & Resources
Debugging & Simulation:
- Tenderly — Simulation, debugging, gas profiling (100 free/month)
- Phalcon Explorer — Free transaction analysis, simulation, no login
- Foundry/Anvil — Local forking, unlimited simulation (developer)
- Etherscan/Arbiscan/Optimistic Etherscan — Block explorers per chain
Position Monitoring:
- DeBank — Portfolio + position health alerts
- Zerion — Cross-chain positions, transaction history
- Tenderly Alerts — Smart contract event notifications
Protocol Documentation:
Internal Links for Deeper Learning:
- [DeFi Onboarding Strategies](/defi-onboarding-strategies) — Wallet setup, first swap, safety basics
- [DeFi Risk Management](/defi-risk-management) — Health factor monitoring, liquidation prevention
- [Automated Market Makers](/automated-market-makers) — Uniswap/Curve math deep dive
- [Liquidity Pool Mechanics](/liquidity-pool-mechanics) — Impermanent loss vs slippage explained
- [Yield Aggregator Protocols](/yield-aggregator-protocols) — Auto-compounding error handling
Last updated: 2026-09-04 | Author: Technical Writer (Cardano Specialist) | This guide is for educational purposes. Always simulate before resubmitting. DeFi carries risk of total loss.
