MetaMask is a widely used software wallet (hot wallet) for interacting with DeFi, dApps, and tokens. Transactions can fail or hang for many reasons — from contract reverts to nonce gaps or hardware-wallet confirmations. This guide explains the common error messages you’ll see (including things like "alert transaction error exception thrown in contract code metamask"), how to diagnose them, and step-by-step fixes I use in daily DeFi work.
Short version: check gas, check nonce, check contract approvals. Then act.
Who should look elsewhere? If you never interact with smart contracts and want cold storage only, a hardware wallet-only routine may be a better fit. But if you need DeFi, this applies.
And breathe. Small fixes often work.
| Error message (what you might see) | Likely cause | Quick fix |
|---|---|---|
| "alert transaction error exception thrown in contract code metamask" | Contract execution reverted (require failed, insufficient allowance, or out-of-gas) | View tx on explorer, decode input, approve token allowance if needed, retry with correct params or higher gas |
| "a wallet connection request is already pending metamask" | Browser/dApp popup or WalletConnect session waiting for user action | Close popup, disconnect site (/disconnect-connected-sites), refresh page |
| "can't confirm transaction metamask ledger" | Ledger app not open, firmware/app mismatch, or contract signing settings | Open Ethereum app on Ledger, update firmware, enable contract data if required, replug device (see /ledger-errors-and-troubleshooting) |
| "pending transaction metamask" (stuck) | Low gas, network congestion, or nonce gap | Speed up/cancel or send replacement tx with same nonce (see steps below) |
When a transaction is stuck the chain is waiting for a specific nonce. You can either replace that transaction (same nonce, higher gas) or cancel it by replacing with a 0 ETH self-send.
Notes: Speed Up/Cancel only appear if your provider and the tx state allow replacements. If you don't see those options, proceed to manual replacement below.
Practical tip: set the replacement gas at least 10%–25% above the original; if the network is congested I often use 30%–50% higher to ensure the miner/validator prefers the replacement.
Reset Account (Settings > Advanced) clears MetaMask's local transaction history. It does not cancel transactions on-chain. Use Reset when MetaMask shows outdated status, not to remove a real pending transaction from the blockchain. See /reset-delete-and-reinstall for details.
Common Ledger causes:
Fixes I use: update firmware and the Ethereum app, re-open the Ethereum application on the Ledger, and replug the device. If a contract call still won't confirm, check the Ledger troubleshooting guide at /ledger-with-metamask-guide and the dedicated errors page /ledger-errors-and-troubleshooting.
And yes — sometimes the solution was simply using a different USB cable. Small things.
This happens when a dApp initiated a connection but the browser popup was blocked or the previous connection request is unresolved. Steps:
Why does this often happen? Browser popup blockers and slow WalletConnect QR handshakes. Patience helps.
Nonce mismatches occur when the network's expected nonce for your account doesn't match what MetaMask is sending. Causes include pending transactions on a different node, multiple clients sending txs from the same private key, or an unreliable RPC node.
Diagnosis:
Fixes: replace the missing nonce with a 0 ETH self-send (same nonce), or use Reset Account after confirming no real pending tx exists. If you run your own node, sync status matters — see /developer-rpc-and-node-guide.
But no method is perfect. Smart contract calls can still revert because of logic inside the contract.
Q: Is it safe to keep crypto in a hot wallet? A: Hot wallets are convenient for DeFi but carry higher risk than cold storage. I keep active funds in a hot wallet and long-term holdings in hardware wallets. See the backup guide: /seed-phrase-backup-recovery and the security checklist: /security-checklist.
Q: How do I revoke token approvals if a contract misbehaves? A: Use a revoke tool or the "Revoke" flow in the dApp (and confirm on explorer) — see /token-allowances-and-revoke for step-by-step guidance.
Q: What happens if I lose my phone? A: If you have your seed phrase, you can restore on another device. If not, funds are unrecoverable. Secure your seed phrase and follow the recovery steps at /seed-phrase-backup-recovery.
MetaMask transaction errors fall into a few repeatable patterns: contract reverts, gas/nonce issues, connection/WalletConnect quirks, and hardware-wallet confirmation problems. Diagnose with an explorer, try Speed Up/Cancel, and use a custom-nonce replacement when needed.
If you use Ledger, consult /ledger-with-metamask-guide and /ledger-errors-and-troubleshooting. If pending transactions are frequent, read /pending-transaction-troubleshooting and review gas mechanics at /gas-fees-eip1559-l2.
If you want step-by-step walkthroughs for the precise buttons and menus, check the related how-to pages: install and setup (/install-metamask-chrome-extension), mobile setup (/metamask-mobile-ios-android), and send/receive flows (/send-receive-with-metamask).
Want help with an actual stuck transaction? I often resolve them by replacing the nonce with a 0 ETH self-send; give that a try. And if that doesn't work, consult the hardware or RPC guides linked above.