I'm listening to events of my deployed contract. Whenever a transaction gets completed and event is fired receiving the response causes following error:

Uncaught Error: Returned values aren't valid, did it run Out of Gas? at ABICoder.push../node_modules/web3-eth-abi/src/index.js.ABICoder.decodeParameters (index.js:227) at ABICoder.push../node_modules/web3-eth-abi/src/index.js.ABICoder.decodeLog (index.js:277)

Web3 version: 1.0.0-beta36

Metamask version: 4.16.0

How do I fix it?

1 Answer 1


This is a bug in web3js, discussed here.

And the following change fixes it (source):

--- a/node_modules/web3-eth-abi/src/index.js
+++ b/node_modules/web3-eth-abi/src/index.js
@@ -280,7 +280,7 @@ ABICoder.prototype.decodeLog = function (inputs, data, topics) {

     var nonIndexedData = data;
-    var notIndexedParams = (nonIndexedData) ? this.decodeParameters(notIndexedInputs, nonIndexedData) : [];
+    var notIndexedParams = (nonIndexedData && nonIndexedData !== '0x') ? this.decodeParameters(notIndexedInputs, nonIndexedData) : [];

     var returnValue = new Result();
     returnValue.__length__ = 0;

Edit: Downgrading to 1.0.0-beta33 fixes the problem as well.

  • updating to latest (v1.2.9) also fixes for me
    – Lee
    Commented Jun 12, 2020 at 10:12

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.