Chrome throws “Failed to connect to MetaMask” even though my React project does NOT use crypto/web3 (Opera works fine)
22:57 29 Nov 2025

enter image description here

I’m building a normal React project (not related to blockchain, crypto, or MetaMask).
However, Chrome gives this uncaught error in the console:

Failed to connect to MetaMask  
at Object.connect (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/scripts/inpage.js)

The strange part:

  • My app does NOT use Web3, ethers, crypto libs, or MetaMask.

  • Opera browser works fine.

  • I’m not calling window.ethereum anywhere.

  • MetaMask is installed on Chrome, but I don’t want it to interfere.

The error happens on page load or during hot reload.

I suspect that one of my dependencies might be checking for window.ethereum, and Chrome MetaMask auto-injects inpage.js, causing a connection attempt that fails.

My question:

  • Why does Chrome MetaMask auto-inject into non-crypto projects and cause this error?

  • Which libraries commonly trigger this?

  • How can I completely disable or sandbox MetaMask injection ONLY for my local dev site or only for this project?

Any help or debugging ideas are appreciated.

javascript reactjs google-chrome google-chrome-extension metamask