metamask-extension icon indicating copy to clipboard operation
metamask-extension copied to clipboard

MetaMask - RPC Error: header not found

Open tonoyandev opened this issue 6 years ago • 47 comments

I don't launched a project for a 5 days and everything works fine. But now the calls like web3.eth.getBalance or contract methods returns:

{code: -32000, message: "header not found"}

Does anything changed during this period, what the header means? Will appreciate your help, thanks in advance.

tonoyandev avatar Sep 30 '19 20:09 tonoyandev

Please provide additional information that could help reproduce your issue. For example code snippets, browser/OS versions, and console/network logs could help explain your issue.

tmashuang avatar Oct 01 '19 20:10 tmashuang

I was able to reproduce this bug. It appears to fail intermittently. This us to a bug with Infura (apparently related to load balancing) - they have a fix in development, but it's still broken in prod at the moment.

In the meantime I'd suggest retrying any requests that fail with this error

Gudahtt avatar Mar 17 '20 18:03 Gudahtt

im also seeing this issue today. was there ever another ticket created with infura for this?

owocki avatar Mar 23 '20 13:03 owocki

This issue has been causing us some trouble for the past couple of days. Can someone prioritize it ?

peculiarity avatar Mar 23 '20 15:03 peculiarity

what is happening? seems this error code -32000 is

            "-32000": {
                standard: "EIP 1474",
                message: "Invalid input."
            },

more about the error https://github.com/ethereum/EIPs/issues/136

code description meaning -32000 INVALID_VALUE parameter contains invalid value INVALID_VALUE 0 invalid input, e.g. missing mandatory input

Maybe something about the new version of metamask dropping support for web3

related https://github.com/MetaMask/metamask-extension/issues/7708

image

Do you get this a lot? @owocki @peculiarity

x5engine avatar Mar 24 '20 03:03 x5engine

Solved it! I was on mainnet and the web3 was set to rinkeby instead so it gave this error!

x5engine avatar Mar 24 '20 03:03 x5engine

@x5engine Could you explain a bit more what you mean by solved?

I am also getting the same error, It would be great if there was some sort of explanation in the error of what is happening and what the error is. Screen Shot 2020-03-24 at 11 37 20 AM

crazyrabbitLTC avatar Mar 24 '20 15:03 crazyrabbitLTC

@crazyrabbitLTC not solved. It's still happening with regularity on mainnet. Appears to be a bug with infura as @Gudahtt mentioned, but I don't know more than that.

b-pmcg avatar Mar 25 '20 10:03 b-pmcg

any update on this issue? We are also experiencing this bug regularly.

charleenfei avatar Mar 26 '20 09:03 charleenfei

the bug happens when you use something not on mainnet To be honest....

x5engine avatar Apr 06 '20 06:04 x5engine

The bug is still happening. Working on Ropsten testnet. Haven't tested on main net, but will do and let you guys know.

01fbk avatar Apr 29 '20 22:04 01fbk

@01fbk let me know! I am waiting!

x5engine avatar May 14 '20 11:05 x5engine

FYI for anyone facing the same issue. I was facing the similar issue on ropsten network I changed my network to mainnet and back to ropsten everything started to work fine.

karankiri avatar Aug 28 '20 17:08 karankiri

This error seems to mean that the specified block number is not on geth.

wjmelements avatar Sep 08 '20 18:09 wjmelements

@karankiri this solved it for me, thank you. I was getting this error when connected to a localnet and needed to switch to mainnet and back for this error to stop throwing.

DannyDelott avatar Oct 30 '20 20:10 DannyDelott

I am getting this error. Does anybody have a solution. Thanks in advance.

Error to read Metamask ERC balance: {"code":-32000,"message":"header not found"}

defidex avatar Dec 07 '20 05:12 defidex

Bump; the error still happens when using getBalance()

hazae41 avatar Mar 05 '21 17:03 hazae41

Error still comes quite often any idea how to solve it?

ChristBKK avatar Mar 22 '21 15:03 ChristBKK

Also seeing this problem often

mikevercoelen avatar Mar 22 '21 15:03 mikevercoelen

currently getting this error frequently too, has something happened recently to cause this?

issue now appears to have resolved itself, perhaps it was an issue with the rpc node metamask was using...

cthr avatar Mar 22 '21 16:03 cthr

This error code is something I have come across frequently in the past and has cropped up again for a project my team is working on. Our current solution is to drop using the MM provider for reading data from ethereum and use a dedicated endpoint directly to infura/alchemy. The issue we experience is that these errors coincide with data not being fetched when connected through the MM provider and using the same address. It does not seem to matter whether it is kovan or mainnet.

In more detail, the issue we are experiencing populates our logs as many have indicated further up the thread. The trace indicates it comes from inpage.js, a file part of the metamask extension and the error code, after trawling through the minified code in the extension indicates these requests providing invalidInput

image

For reference the json-rpc specification reserves -32000 for implementation defined errors image

This invalidInput could mean potentially a few things but one thing to rule out is that from rigorous testing it is not caused by incorrect input to contract calls and must be resulting between MM and the infura connection it uses.

I don't have any conclusive idea as to what is causing this but I have a gut feeling that it could be throttling. I say this as I have been able monitor the network traffic of the MM extension and the requests are being made to infura and responding without error as shown below.

image

The project does make a relatively large amount of requests, ~1000/min which in our experience has caused the issue to surface quickly compared to other projects.

MM must have some form of backend which monitors the transaction data so that it can validate txs failing or not, I'm sure many who have used MM have observed this before signing. The question is that is there an intermediary backend between client & node which is used to monitor data fetches or at least throttles after heavy usage? One interesting observation is that while receiving these -32000 errors and potentially being throttled, switching to another address in the same extension worked without issue. Switching back to the first address resulted in the errors again.

It would be appreciated if someone from MM could comment on the issue as it has been over 2 years since this issue has been flagged with little to no response

Padraic-O-Mhuiris avatar Apr 05 '21 20:04 Padraic-O-Mhuiris

We recently launched on BSC and we have this error showing up often as well.

AoDev avatar Apr 14 '21 13:04 AoDev

Clients have this issue with the https://ethereumico.io/multisend/ service.

olegabr avatar May 11 '21 08:05 olegabr

I'm also experiencing this error on BSC.

sabotagebeats avatar May 12 '21 18:05 sabotagebeats

Looks like this fixed this problem in my case: address = web3.utils.toChecksumAddress(address.replace("0X", "0x"))

olegabr avatar May 13 '21 08:05 olegabr

Switching networks back and forth in Metamask makes the error disappear !!! I got this error when I was resetting the blockchain and trying to reconnect with the same settings.

bellaj avatar Aug 08 '21 10:08 bellaj

I'm having the same problem here.

raulvictorrosa avatar Aug 24 '21 18:08 raulvictorrosa

Commenting on this bug for every project we encounter it on. Second project this week. Had to introduce artificial delays to the promises calling the contract read functions in order to get around it. Please fix this its really bad.

What's worse is it only seems to present itself on mainnet in my experience.

dwasyluk avatar Oct 10 '21 21:10 dwasyluk

For others hitting this issue we worked around it by introducing a 100ms delay between RPC requests.

dwasyluk avatar Oct 11 '21 00:10 dwasyluk

On my private clique network, the issue was popping up every time.

Geth was running with --miner.gasprice 1

This made Metamask to use scientific notation in the Send screen as far as gas price was concerned. I started Geth with --miner.gasprice 10000000 and the issue automagically went away.

Hope it fixes it for someone out there.

quakemmo avatar Nov 08 '21 10:11 quakemmo