How to fix 'No chain ID defined' error in MetaMask
You could also see the following error messages:
Root Error: Missing chain idRoot Error: Invalid chain ID
If you manually added the network to MetaMask, head to Settings > Networks and make sure the chain ID associated with the network is the correct one. To find a chain ID, you could head to Chainlist, which maintains a catalogue of EVM-compatible networks and their details, or search for the relevant documentation of the network itself.
If you are using Ethereum Mainnet, try toggling networks: switch from Ethereum Mainnet to another network, and then back again.
Make sure you are also running the latest version of MetaMask.