SECURITY WARNING: Never run commands you don't understand. Always review code before execution. Use at your own risk.
Web3 New Added 19 September 2026

Web3: cannot estimate gas; transaction may fail or may require manual gas limit

The node ran the transaction against current state and it reverted, so no gas figure could be produced. The wording suggests a gas problem but the cause is almost always the call itself: a missing token approval, a paused contract, or a require that fails for this sender.

Quick fix

Read the commands before running them. Anything that restarts a service, deletes data or changes permissions should be tried on a non-production system first.

Quick fix
// Get the real reason: a static call runs the same code and surfaces the revert
try {
  await contract.transferFrom.staticCall(from, to, amount);
} catch (e) {
  console.log(e.reason ?? e.shortMessage);   // e.g. "ERC20: insufficient allowance"
}

// The two causes that account for most of these
await token.allowance(owner, spender);        // approve first
await provider.getBalance(owner);             // value plus gas must fit

# Same check from the command line, against the block that fails
cast call $CONTRACT "transferFrom(address,address,uint256)" $FROM $TO $AMT --from $OWNER

// Forcing a gas limit does not fix a revert, it only pays for one
// await contract.transferFrom(from, to, amount, { gasLimit: 200000n });

// If it only fails on a fork or a testnet, the contract at that address differs
await provider.getCode(contractAddress);      // 0x means nothing deployed there

How to diagnose Web3 errors

Web3 errors are unusually terse because the EVM reports failure without explanation by default. execution reverted means a require or revert triggered. The reason string is present in the return data but most libraries discard it. Nonce errors reflect the strict sequential ordering of transactions per account, so a stuck transaction blocks every one behind it.

If the quick fix above does not resolve it, work through these steps. They apply to this whole class of error, not just to this one message, which is usually what saves the time.

  1. Simulate before sending: eth_call against the same block returns the revert reason string that a submitted transaction hides.
  2. Use a transaction tracer (Tenderly, Foundry's cast run, or a node's debug_traceTransaction) to see the exact opcode and contract where execution reverted.
  3. For nonce errors, query the account's pending nonce (eth_getTransactionCount with the pending tag) rather than tracking it locally.
  4. To replace a stuck transaction, resend with the same nonce and a materially higher gas price: most nodes require at least a 10% increase.
  5. Check the chain ID matches the network you intend. Signing for the wrong chain produces confusing rejection messages.

Tools worth reaching for

  • cast (Foundry)
  • eth_call simulation
  • Tenderly / block explorer tracer
  • debug_traceTransaction

Authoritative references

Primary documentation for this error, worth reading before applying any fix in production.

docs.ethers.org ethereum.org

Related Web3 errors

See all 10 Web3 errors →

Browse other categories

Something missing or wrong?

This entry is maintained by hand. If the fix is out of date, incomplete, or you have a better one, email a correction and it will be reviewed.