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

ethers v6: Cannot read properties of undefined (reading 'Web3Provider')

ethers v6 removed the providers, utils and constants namespaces, so v5 code such as ethers.providers.Web3Provider or ethers.utils.parseEther reads a property of undefined. It usually appears when a fresh npm install pulled v6 into a project or tutorial written for v5. The classes still exist, mostly under new names on the top-level export, and amounts are now native bigint instead of BigNumber.

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
# Which major version is installed?
npm ls ethers

# v5 to v6 renames
#  new ethers.providers.Web3Provider(window.ethereum) -> new ethers.BrowserProvider(window.ethereum)
#  new ethers.providers.JsonRpcProvider(url)          -> new ethers.JsonRpcProvider(url)
#  ethers.utils.parseEther("1.0")                     -> ethers.parseEther("1.0")
#  ethers.utils.formatUnits(x, 6)                     -> ethers.formatUnits(x, 6)
#  ethers.constants.AddressZero                       -> ethers.ZeroAddress
#  BigNumber.from(x), a.add(b)                        -> BigInt(x), a + b
#  provider.getSigner()                               -> await provider.getSigner()

# Or pin v5 until the migration is done
npm install ethers@5

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

Related Web3 errors

See all 17 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.