Insufficient funs for gas * price + value

I have been receiving the following error intermittently when making “calls” on rinkeby and mainnet for the past few days:

{ code: -32000, message: “err: insufficient funds for gas * price + value (supplied gas 124390060)” }

It has started working again on rinkeby with no code change or system upgrades on my end. However, mainnet is still running into this problem.

The thing is that the code is not even trying to send a transaction when it happens. The code is simply making read-only function calls.

It usually clears up after some time (like rinkeby has), but this has persisted for several days so I’m concerned about an Infura stability issue.

This has finally cleared up on mainnet after several days. Was there a problem with the infura nodes over the weekend?

Hi @paypr - we saw some increased response times mid-last week. In the future, if you want to check the status of our nodes, visit https://status.infura.io/

Yeah, I checked the status page and there was nothing going on. Just checked again, and there’s no indication that the service was effectively unavailable for 5 days.

The error was likely caused by something around the nature of the eth_call you were making; perhaps that the from account you’re using to make your eth_call doesn’t have enough ETH to cover the gas of the transaction. If you want to look into it further, you can check this link out.

However, if you can give us the details of the eth_call you’re making, we can see what workarounds we can suggest to prevent this from happening in the future!

OK, I’ve been able to add some more logging to my production system to pinpoint the calls and determine the root cause. The issue is that even read-only calls (eg to ERC-20 token balanceOf) are checking the ethereum needed for gas, which is never needed since all read-only calls are local to the node.

We are explicitly setting the gas price on every call or send-tx so that we can get the most up-to-date gas prices on every call. This works great for send-txs because we would check to make sure that there’s enough Ethereum on the account for the gas needed for the call. If not, it may error in a different way, but we haven’t seen any of these because we aren’t running very many send-tx. But for some reason, even simple calls like balanceOf were using a large amount of gas, and when calculated with the gas price of the hour, it would sometimes go over the amount in the account.

The solution is for us to explicitly use a gasPrice of 0 when making read-only calls.

I hope this helps others who may run into this.

2 Likes

Thanks for updating for others who may run into this in the future!