13

I'm using MetaMask with an app I'm developing, and previously working functions are now returning a quite ferocious error.

This error has been duplicated on a number of functions in the platform, so I won't provide specific code to any given function. All of them are web3 functions that submit transactions - functions that only read data from the chain work fine.

I also checked just sending Rinkeby ETH to another account, and that also failed.

Here's the error:

Error: [ethjs-query] while formatting outputs from RPC 
'{
    "value":{"code":-32603,"message":"Internal JSON-RPC error.",
    "data":{"code":-32000,"message":"invalid sender"},
    "stack":"o@moz-extension://125500d6-db15-4fb6-bc31-b59dc631b8ab/background.js:60:358924\ns@moz-extension://125500d6-db15-4fb6-bc31-b59dc631b8ab/background.js:60:361390\ninternal@moz-extension://125500d6-db15-4fb6-bc31-b59dc631b8ab/background.js:60:361794\nl@moz-extension://125500d6-db15-4fb6-bc31-b59dc631b8ab/background.js:60:35483\n[715]</</t.exports/<@moz-extension://125500d6-db15-4fb6-bc31-b59dc631b8ab/background.js:60:34640\n"
}}'

As per this I tried resetting the account in MetaMask, but it did not help.

What causes this error? I see that it's saying the sender is invalid, but can't figure out what that means in this context. Thoughts?

Update: In response to @goodvibration's request for code, I will put some code from one of the functions that failed. As stated above, many functions failed, in fact any function writing to the chain, and not only functions failed, a simple send from inside MetaMask (sending Rinkeby Ether from one address to another) also failed, clearly demonstrating that this is not an issue with code.

Here's an example function:

const signer = props.injectedProvider.getSigner()
const contract = new ethers.Contract(process.env.CONTRACT_ADDRESS, abi, signer);
const result = await contract.updateRole(arg1, arg2, name)
        .then(() => submitted())
        .catch(e => err(e));

This is React code. The injectedProvider is an ethers.js provider passed in from higher up in the component tree as props. The contract address is stored as an env var, and functions correctly. updateRole is the name of the function being called in the target contract. submitted and err are popup notifications defined elsewhere in the code.

Even if there were to be a problem in the code, though, it would not be the (only) cause of the error mentioned above. As stated before, my rationale for this is that even simple sends inside MetaMask fail with the exact same error. Thanks!

2
  • All of them are web3 functions that submit transaction - can you please share the relevant code? Nov 3, 2020 at 10:22
  • I don't see how it will help, as even simple sends inside MM fail, but I've added it. Thanks for looking! Nov 3, 2020 at 14:46

8 Answers 8

6

this is maybe too simple - but in my case, restarting my react app and my local blockchain solved this problem.

Also I recognized that I run into that issue a lot while using Firefox. It also helped me to switch the browser to Google Chrome.

The Renaissance and I got to the conclusion, that switching to any Chromium browser (eg Chrome, Chromium, Brave, and I guess even Edge) could be a solution for that issue. Both of us run into that problem while using Firefox.

4
  • 1
    Hi! It won't help for a testnet, which is what I was asking about in the question, but this seems to solve similar issues for a lot people, so I've upvoted anyway in case it helps someone else. Apr 20, 2021 at 11:19
  • Oh, right. Sorry I couldn't help you and thanks for upvoting. Hope it helps someone else 🙏
    – Lu_
    Apr 21, 2021 at 11:39
  • You point about Firefox is interesting, though. I never resolved the issue directly, and I was on Firefox at the time. If I remember right, I worked around the issue by using Brave, which is a Chromium browser - this might be the answer after all! If you don't mind editing to include any Chromium browser (eg Chrome, Chromium, Brave, and I guess even Edge), I'll accept it. Apr 21, 2021 at 11:43
  • Of Course - Thank You :))
    – Lu_
    Apr 21, 2021 at 11:47
13

Method 1: Change the browser to chrome(this worked for me)

Method 2:If you are on chrome aldready then follow these steps => 1) go to settings => advanced settings => click on Reset account

      2)try running the code again, this works for sure

enter image description here

enter image description here

enter image description here

3
  • 2
    Reset Account did it. Thanks
    – vijeth.ag
    Jul 28, 2021 at 6:11
  • 2
    That worked. Thx!
    – yuchen
    Oct 29, 2021 at 4:42
  • 2
    Thanks. This worked properly.
    – Steven K
    Feb 25 at 11:32
5

My situation:

I met the same error while I'm working on my project on localhost (reactjs) with local Ganache blockchain.

Reading data from chain works fine but writing data causes Metamask to show the exact same error:

Error: [ethjs-query] while formatting outputs from RPC 
'{
    "value":{"code":-32603, ... 
}

enter image description here

At the same time, Metamask suggested unexpectedly high gas amount (~0.12 ETH at gas fee of 20 Gwei).


Solution that works for me:

I tried restart my Ganache blockchain, tried everything all over again by importing new account using address provided by Ganache to Metamask.

Then, everything started to work perfectly fine. The transaction is successful and it takes only 0.002412 ETH at 20 Gwei per gas fee.


My summary for you:

I know you are not developing on local blockchain but on Rinkeby network. So restarting the blockchain is not possible. What I can suggest is that this definitely is not an issue with your code, possibly some syncing issue of your Metamask to the blockchain.

Try restarting browser or even your PC. Let me know if this works. I see a lot of people are encountering this issue but there's no exact solution for it. I hope this time we will have a clear solution.

1
  • Thanks for your answer! Unfortunately, I do still get this issue after restarting the browser and PC. I'm still upvoting your answer since it's useful for anyone who is using a dev chain. Nov 30, 2020 at 7:10
1

In my case, I solved this by increasing the gas price. Please let me know if that works.

1
1

Maybe you could try to reset your account. In this case: MetaMask settings -> Advanced -> Reset Account.

0

Increasing the gas fee fixed the issue for me. I had to pick the fast transaction gas fee. The Average and the slow transaction wouldn't work at all. I even switched browsers. That didn't work. The only thing that works for that error message is to select the fast transaction gas fee. It worked right away.

1
  • This worked for me as well. It is weird because I expected a "Did you run out of gas?" error or similar, but I ended up making it work by increasing the gas fee. This happened using a local fork with ganache-cli in the Polygon network
    – Gonzalo.-
    Aug 27, 2021 at 19:51
0

all read calls of blockchain works all write calls of blochain does not work

       var tx = await contractReference.functionName(parameter1, parameter2);
       console.log(tx) //this statement will not execute

metamask will show transaction pending for some time and then it will fail with error -

MetaMask - RPC Error: [ethjs-query] while formatting outputs from RPC '{"value":{"code":-32603,"data":{"message":"header not found"

or something like it. I am using metamask with development network connected to truffle by truffle develop command and frontend is made with react and connection library is ethers.js

if anyone gets stuck here the solution steps are -

metamask - disconnect from website
////////////////////////
VIMP STEP
metamask -> setting -> advance -> reset account 
////////////////////////
close localhost website

on npm terminal -
    ctrl + c
    y

on truffle terminal-    
    .exit
    truffle develop
    migrate

on npm terminal
    npm start

open localhost

I hope this helps someone

0

enter image description herethis problem happened to me after many tries and errors I tried to change my chain id to the wallet that give me 31337 and it works enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.