'MetaMask RPC error? 'MetaMask - RPC Error: Internal JSON-RPC error.'

I'm developing the front-end to an application that I'm trying to test. However, MetaMask keeps giving me this error? I tried changing the gas limit like previously suggested and nothing. Any ideas?

Error: MetaMask - RPC Error: Internal JSON-RPC error.

code: -32603 data: {code: -32000, message: "gas required exceeds allowance (30000000) or always failing transaction"} message: "Internal JSON-RPC error."



Solution 1:[1]

Without seeing the code, it's hard to say for sure but you could try:

  1. Check any code you changed in the front end, specifically in your code you may have something like this:
const contractInstance = new state.web3.eth.Contract(
    MyContract.abi,
    "0x.....",            // contract address
    {
        from: state.accounts[0],
        gasPrice: 1000,
        gas: 100000
    }
);

Make sure the gas prices are similar to those, you may have to adjust for your case.

  1. Re-compile and redeploy --> for truffle, run truffle develop first, then compile then migrate --reset for local deployment.

  2. In Metamask, reset your test account. Metamask > Select Account > Settings > Advanced > Reset account. Only do this for testing accounts

Solution 2:[2]

Previously it used to happen in older versions due to a gas specification issue which was fixed. rpcErrors.internal` expects a string as the first argument, with arbitrary data being the optional second argument. Passing in a non- string first argument results in the error being shadowed by an error from eth-json-rpc-errors.

Please check what you are passing to Metamask.

Solution 3:[3]

In my case, after trying so many options I have restarted Ganache and re-imported new account from Ganache to Metamask. I connected this new account with localhost application.

This resoles my issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ttoshev
Solution 2 Aurobindo Nayak
Solution 3 Dharman