Debugging smart contract errors can be surprisingly hard. There is one particular kind of error that annoys me the most: the infamous rpc error with payload.

For instance, just a few hours ago, while deploying a smart contract from the front-end using new web3.eth.Contract().deploy() into ganache-cli, I got the following in the browser's console:

MetaMask - RPC Error: Error: [ethjs-rpc] rpc error with payload {
  "id": 4972589614702,
  "jsonrpc": "2.0",
  "params": ["<a long hex string>"],
  "method": "eth_sendRawTransaction"
} [object Object]

I've seen other errors like this while googling it, except the last part, [object Object], contains an actual error message. But in my case, no.

I tried converting the long hex string to Unicode, but no luck:

> web3.utils.toUtf8('<a long hex string>')
Uncaught Error: Invalid UTF-8 detected

Then I tried with the .toAscii method and got garbled text. Some of it was legible, though; here's a sample:

'\u0003\u0019\u0016R` \u0001P[PPPP`@Q\u0003
a\u0017)Wþ[\u0004PPPPPVþSafeMath: multiplication overflow¢ebzzr1X \u001aó9r\n' +

However, since there were other error strings as well, I doubt that this is the actual error. So maybe it was fruitless to try to decode that hex string.

After banging my head against the wall for some time, I truffle compiled the solidity code again, copied the new JSON into my front-end, and things were working again. Most people seem to solve these errors in seemingly random ways like this, but there should be a less frustrating path. So I have two questions for you:

  1. What steps do you recommend to debug this kind of error?
  2. Is there an issue raised somewhere to make handling this kind of error a little bit more dev-friendly?

2 Answers 2


This error sometimes appears when Metamask's nonce cache becomes invalid after ganache has been restarted.

In that case the solution is to reset Metamask, Settings - Advanced - Reset Account.

  • Never sleep on resetting on Metamask. I've wrestled with "bugs" for hours just to have it be this.
    – sloreti
    Commented Sep 21, 2020 at 23:40

Here's a partial list of things to try after getting that error when deploying a contract:

  • Increase the gas
  • Make sure the constructor arguments are OK
  • Reset Metamask
  • Recompile the smart contract
  • Remove any require statements from the constructor

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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