Frequent `Header Not Found` Errors From API

I have a process that listens for new blocks to be mined via the ethclient.SubscribeNewHead function and then processes a few different things (fetching token balances, etc…)

For some reason when attempting to fetch information from the blockchain this occasionally gives me the header not found error. It seems like this error is mostly occurring from usage of a multicall contract.

Hey @bonedaddy - it sounds like you’re using Go Ethereum, is that correct?

Can you please send over the snippet of code you’re calling when you get the header not found error?

Yup I am, specifically the ethclient package with websockets to connect to infura. this gist includes all the code samples you’ve asked for.

multicall_simple_bindings.go are the abigen generated code to interface with MultiCallSimple.sol.

multicall.go is a small client that wraps the golang bindings

multicall_test.go are the unit tests for that client. I’ve attached a screenshot which shows the error being returned from a test run within TravisCI.

failure

This doesnt appear to happen that often, and if I look at the docker logs for my service within the last 12 hours or so I’ve only seen the error returned twice.

Any updates on this?

Hey @bonedaddy, so sorry for the delay!

I’m not super familiar with Java, and it seems like it’s not a very common issue, as you mentioned. Since it’s not happening too frequently, I’m not sure I can give you a definitive answer on how to fix it. However, if you can track the errors occurring, we can work together to figure out when/why it may be happening!