const result = await myContract.methods.myMethod(1).call();

brings the error from above. There is a simmilar questions here but since I use call gas shouldn't matter. I'm using "web3": "1.0.0-beta.35", (Beta.36 doesn't work for me at all.)

  • Use 1.0.0-beta.34 or 1.0.0-beta.37 or (best) 1.2.x (which relies on beta37 AFAIK). Commented Nov 28, 2019 at 10:38

8 Answers 8


Note that I believe this is fixed in the latest v3.0.0 of web3 which isn't out yet. This issue is now occuring for Binance Smart Chain. In the meantime, this fix worked for me:


  • 1
    Nice seeing you around Mauvis! Thanks for the help. Commented Oct 29, 2021 at 2:28

Are you using Quorum? If you are, this is probably because you are using RAFT consensus algorithm, you have to amend web3 or change to IBFT


Try using BigInt() to resolve this issue. BigInt is an object which provides a way to represent whole numbers larger than 253 - 1, which is the largest number JavaScript can reliably represent with the Number primitive.


const balance = await contractInstance.balanceOf(accounts[0]);
console.log('Balance of Account 0 =', BigInt(balance));
  • 1
    New error TypeError: Cannot convert a BigInt value to a number
    – Tien Do
    Commented Aug 30, 2021 at 4:03
  • Same error as @TienDo. Any fix for this? Commented Mar 5 at 19:19

That is Javascript integer limitation (Number.MAX_SAFE_INTEGER).

In order to work-around it, pass a String or as BigNumber instead.

For example:

const result = await myContract.methods.myMethod("1000000000000000000000").call();
const result = await myContract.methods.myMethod(new BigNumber(2).pow(54)).call();
  • In this case, await myContract.methods.myMethod("1").call();
    – user19510
    Commented Sep 20, 2018 at 17:26
  • @smarx: Yes, of course, but I don't see how this case (or any other case for that matter) could yield the error at the title. I guess he's doing something with the returned value which eventually causes this error (something which he hasn't posted here). Commented Sep 20, 2018 at 17:27
  • So you believe your answer is incorrect?
    – user19510
    Commented Sep 20, 2018 at 17:30
  • I don't do anything with the answer. I also tried with a sting or BigNumber but without success. As a workaround I'm using truffle-contract now which works fine.
    – MarcS82
    Commented Sep 20, 2018 at 17:49
  • @smarx: No, I believe that the question is missing some info. Either that, or there's a serious bug in "web3": "1.0.0-beta.35", which I sincerely doubt (though I've been using 34 for quite some time, so I'm possibly wrong on that one). Commented Sep 20, 2018 at 19:58

This will also happen if you set gasPrice to be some very large value when sending transaction like: 15e64.


In many blogs I've found it was a Truffle version problem. Truffle v5 would make problems of this type. They suggest to downgrade to [email protected].

This has not been so for me. I have continue to use truffle v5. I've resolved by checking my gas limit when I sent a transaction. gasLimit: web3.utils.toHex( gas_limit ),//The maximum gas provided for this transaction (gas limit)

Node: v8.11.4 Truffle: 5.0.12 Web3: 1.0.0-beta.52 Truffle-contract: 4.0.11 [email protected] │ └── [email protected] └── [email protected] Ganache-cli: v6.4.3 (ganache-core: 2.5.5) Ethereumjs-tx: 1.3.4


Check the contract code again please, You may have added some require(msg.sender == owner) like modifier and you code doesn't return some data which can be processed in client side.


Ultimate Solution

Simple install web3 latest version which is version 4

npm install [email protected]

That solved my problem

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.