Fix a swap problem

Gas estimation failed before a swap: should I continue?

Understand what a failed preflight estimate is warning about and why entering a manual gas limit may not fix a swap.

Gas estimation can fail because the proposed transaction is expected to revert, or because the wallet cannot obtain a usable estimate. Those are different problems. Entering a manual gas limit does not establish that the swap can execute.

Read the detailed error first

If it names insufficient allowance, an expired request or a token restriction, address that condition before signing. If it reports a network connection problem, verify the wallet’s connectivity and transaction state instead. A generic wrapper message may hide the more useful contract error beneath it.

Uniswap’s expected-to-fail guidance identifies variable token fees, unsellable tokens and unusual approval or token behavior as possible causes. This makes the warning useful evidence, not an obstacle to dismiss automatically.

A bounded diagnostic sequence

  1. Check the account, chain, input balance and current spender permission.
  2. Refresh the quote so its deadline and route reflect current conditions.
  3. Check the token’s transfer rules and the router’s documented compatibility.
  4. If the estimate still fails, retain the detailed message for official support.

Trying a smaller amount can be a diagnostic observation, but success at one amount does not prove every amount will work or that the token is safe.

A manual limit is appropriate only when you have a credible reason that execution is valid and the estimator itself is the problem. Otherwise it can transform a free warning into a paid onchain failure. A higher limit cannot force a contract to ignore a failed condition, and a higher gas price cannot change the permitted execution logic.

Sources & verification (3)

Source-check date is recorded in the article details. URLs are provided for manual verification. Use Copy to keep this page open.

  1. Error message: Transaction is expected to fail

    Preflight warning causes; not reproducing unsafe high-slippage examples.

    https://support.uniswap.org/hc/en-us/articles/23334343679501-Error-message-Transaction-is-expected-to-fail
  2. Gas and fees

    Gas measures execution work; actual fees, out-of-gas behavior and fee components.

    https://ethereum.org/developers/docs/gas/
  3. ERC-6093: Custom errors for commonly-used tokens

    Distinct structured errors for insufficient balance and allowance.

    https://eips.ethereum.org/EIPS/eip-6093

Continue reading

Swap out of gas: when changing the gas limit helps TRANSFER_FROM_FAILED: check allowance, balance and token restrictions