Securityadvancedarticle30 min read

DeFi Troubleshooting Guide: Fix Failed Transactions Fast | VCC

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

Vietcardano teamTeam

Đội ngũ biên tập VietCardanoCommunity — các chuyên gia blockchain và Cardano, cung cấp nội dung giáo dục và nghiên cứu chuyên sâu cho cộng đồng.

Published September 14, 2026

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

Diagram - Common DeFi error categories and root causes

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 reached
  • Max 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 / PriceImpactTooHigh
  • InsufficientLiquidity / AmountOutBelowMinimum
  • TickLower / TickUpper (Uniswap V3 concentrated liquidity)

The fix: Use protocol-specific slippage defaults, not a universal 0.5%:

ProtocolPool TypeRecommended SlippageWhy
Uniswap V2/V3Volatile pairs0.5-1%Standard AMM
Uniswap V3Stablecoin (USDC/USDT)0.05%Tight range
Curve FinanceStable pools (3pool, etc.)0.01%StableSwap invariant
Curve FinanceCrypto pools (stETH/ETH)0.5%Volatile assets
BalancerWeighted pools1%Multi-token
PancakeSwapBSC volatile1-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 / NonceTooHigh
  • ReplacementTransactionUnderpriced (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.

ProtocolGuard MetricFormulaLiquidation Trigger
Aave V3Health Factor (HF)(Collateral × LiqThreshold) / TotalDebtHF < 1.0
Compound V3Collateral Ratio (CR)(CollateralValue × CollateralFactor) / BorrowValueCR < 1.0
GMXOracle Price DeviationmarkPrice vs oraclePrice> 2-3% deviation
MakerDAOCollateralization RatioCollateralValue / 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

Flowchart - DeFi transaction failure decision tree

Follow this sequence every time. Skip steps at your own risk — and gas expense.

Sequence - DeFi debugging workflow for failed transactions

Step 1 — Identify the Error (Get Tx Hash, Check Explorer)

  1. Copy the transaction hash from your wallet (MetaMask: Activity → Click tx → Copy hash)
  2. Paste into the correct explorer:
  3. Ethereum: etherscan.io/tx/
  4. Arbitrum: arbiscan.io/tx/
  5. Optimism: optimistic.etherscan.io/tx/
  6. Base: basescan.org/tx/
  7. BSC: bscscan.com/tx/
  8. Polygon: polygonscan.com/tx/
  9. Check Status: "Fail" / "Reverted" / "Out of Gas"
  10. Click "Click to see more" → note the Error field (may show raw bytes)
  11. 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)

  1. Go to dashboard.tenderly.co → "Simulate Transaction"
  2. Paste tx hash → "Simulate"
  3. Click "Debugger" → "Revert Reason" shows human-readable error
  4. For custom errors: Tenderly auto-fetches ABI from verified contracts

Phalcon Explorer (Free, no login)

  1. Go to phalcon.xyz → paste tx hash
  2. "Call Trace" tab → find red "REVERT" node
  3. Click → shows decoded error with parameter values

Developer option (Foundry/Cast): `bash

cast run --rpc-url $RPC_URL --debug

`

Step 3 — Verify Pre-Conditions (Balances, Allowances, Nonce)

Before resubmitting, confirm the basics:

CheckToolWhat to Verify
Token balanceExplorer / cast balanceSufficient for amount + gas
Token allowancecast call "allowance(address,address)(uint256)" ≥ transaction amount
Native balanceExplorer≥ gas limit × maxFeePerGas
NonceExplorer "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):

  1. In Tenderly Debugger, click "Simulate Changes"
  2. Modify: gas limit (×1.3), slippage, allowance, etc.
  3. Run simulation → confirm "Success" status
  4. Copy the exact calldata for resubmission

Phalcon (Explorer-integrated):

  1. In Phalcon call trace, click "Simulate"
  2. Adjust parameters in UI
  3. Re-run → verify success

Foundry Local Fork (Free, unlimited): `bash

anvil --fork-url $RPC_URL --fork-block-number latest

cast send "function(args)" --value 0 \ --gas-limit \ --rpc-url http://localhost:8545 \ --private-key $PRIVATE_KEY `

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 CauseParameter Adjustment
Gas estimationIncrease gas limit 30-50% (1.3-1.5×)
SlippageIncrease tolerance to protocol default (see table)
AllowanceSubmit approve(max uint256) first
Nonce gapSend 0 ETH self-tx with correct nonce
Health factorRepay debt OR add collateral
Custom errorFix 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)

  1. Wait for confirmation (1-3 blocks on L2, 1-5 on Ethereum)
  2. Verify status = "Success" on explorer
  3. Check position: DeBank, Zerion, or protocol UI
  4. For lending: monitor health factor for 24h after volatile moves
  5. For LP: verify position appears in pool, track impermanent loss

Protocol-Specific Error Handling Comparison

Comparison - Error types across major DeFi protocols

No two protocols handle errors the same way. This comparison saves you from applying Uniswap logic to Aave.

Uniswap V2 / V3

AspectV2V3
Error formatRevert stringsCustom errors (Solidity 0.8+)
Key errorsINSUFFICIENT_LIQUIDITY, EXCESSIVE_SLIPPAGESlippageExceeded, TickLower, TickUpper, SqrtPriceLimit
Slippage paramamountOutMin (calculated off-chain)amountOutMinimum + sqrtPriceLimitX96
Debug toolTenderly, EtherscanTenderly (best ABI support), Phalcon
Gas quirkSimple swap ~150k gasMultihop + 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

ErrorMeaningFix
HealthFactorTooLowPosition undercollateralizedRepay borrow OR supply more collateral
ReserveFrozenAsset paused by governanceWait for unfreeze or use different reserve
BorrowCapReachedProtocol borrow limit hitWait or use different market
SupplyCapReachedProtocol supply limit hitWait or use different market
InvalidCollateralAsset not enabled as collateralCheck 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

ErrorMeaningFix
InvariantViolationStableSwap math broke (shouldn't happen)Report to Curve — likely pool corruption
BelowMinAmountReceived less than min_amountIncrease slippage tolerance
AboveMaxAmountDeposit exceeds pool capacityReduce deposit amount
VirtualPriceDecreasedPool 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)

ErrorMeaningFix
CollateralRatioTooLowPosition undercollateralizedRepay borrow OR supply more collateral
BorrowCapReachedMarket borrow limitWait or different comet
SupplyCapReachedMarket supply limitWait or different comet
PriceOracleStaleChainlink feed outdatedWait 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)

ErrorMeaningFix
PriceImpactTooHighOrder moves mark price > thresholdReduce position size
OraclePriceDeviationMark price vs oracle > 2-3%Wait for convergence
FundingRateCapFunding rate at protocol maxPosition auto-closes at cap
InsufficientMarginMargin < maintenanceAdd 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

Reference - Quick lookup table for common DeFi error codes

Bookmark this table. When a transaction fails, find the error code → apply the solution.

Error Code / MessageProtocol(s)Root CauseCopy-Paste Solution
TRANSFER_FAILED / InsufficientBalanceAll ERC20Balance < amount OR allowance < amountcast call "balanceOf(address)" → if 0, acquire tokens. cast call "allowance(address,address)" → if < amount, cast send "approve(address,uint256)"
INSUFFICIENT_LIQUIDITYUniswap V2/V3, SushiSwapPool reserves depleted for your amountReduce swap amount 50%, retry. Or find deeper pool (different fee tier on V3)
SLIPPAGE_EXCEEDED / SlippageExceededAll DEXsPrice moved beyond toleranceIncrease slippage: Uniswap 0.5%→1%, Curve 0.01%→0.05%, Balancer 1%→2%
HEALTH_FACTOR_TOO_LOW / HealthFactorTooLowAave V2/V3Collateral value dropped or debt increasedOption A: cast send "repay(address,uint256,address)" Option B: cast send "supply(address,uint256,address,uint16)"
COLLATERAL_RATIO_TOO_LOW / CollateralRatioTooLowCompound V3Collateral value droppedSame as Aave: repay or supply more. Check getAssetInfo() for collateralFactor
EXPIRED / Permit2: ExpiredPermit2, EIP-2612Signature deadline passedRe-sign with new deadline: deadline = block.timestamp + 3600 (1 hour)
NONCE_TOO_LOW / NonceTooHighAll EVMStuck earlier transactionUniversal fix: cast send "" --value 0 --nonce --gas-limit 21000
OUT_OF_GAS / Out of gasAllGas limit too low for executionIncrease gas limit: simple swap 200k→300k, complex multicall 500k→800k
PRICE_IMPACT_TOO_HIGHDEXs, GMXOrder size > pool depthSplit into 3-5 smaller orders over 10-15 minutes
TICK_LOWER / TICK_UPPERUniswap V3Position range exceededRe-mint position with wider range, or accept impermanent loss
RESERVE_FROZENAave V3Asset paused by governanceCheck governance forum. Usually temporary (hours-days)
BORROW_CAP_REACHEDAave, CompoundMarket borrow limit hitWait for repayments to free capacity, or use different market
MIN_AMOUNT_OUT / BelowMinAmountCurve, BalancerSlippage protection triggeredIncrease min_amount parameter (lower = more tolerant)
ORACLE_PRICE_DEVIATIONGMX, SynthetixMark price diverged from oracleWait 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:

  1. Complete P2P purchase first, wait for on-chain confirmation
  2. Then submit DeFi transactions
  3. 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

WalletGas BufferL2 SupportNonce Handling
Coin981.1×Basic (Arbitrum, BSC)Local counter, desyncs on background
MetaMask Mobile1.5×Full (all L2s)Syncs with network on app open
Trust Wallet1.2×BasicLocal counter
Rainbow1.3×FullNetwork-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:

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.

Tags:

defi troubleshooting guidesdefi troubleshooting guidewhat is defi troubleshooting guidesdefi troubleshooting guides guide