I am always getting this erros with get calls i am using React, Truffle, metamask and Ganache

Uncaught (in promise) Error: Invalid number of arguments to Solidity function at Object.InvalidNumberOfSolidityArgs (errors.js:25) at SolidityFunction../node_modules/web3/lib/web3/function.js.SolidityFunction.validateArgs (function.js:74) at SolidityFunction../node_modules/web3/lib/web3/function.js.SolidityFunction.toPayload (function.js:90)at SolidityFunction../node_modules/web3/lib/web3/function.js.SolidityFunction.call (function.js:131) at contract.js:135 at new Promise ()


let id = e.target.dataset.somefield;



struct {
string lastName;

getLastName(unit256 _id)public view returns (string){
unit256 id = customersIndex[_id];
return customers[id].lastName;


2 Answers 2


I'm not 100% sure about this but check compatibility between your solc compiler and the backing chain.

The Byzantium fork is a protocol change that includes changes to the interface. In order to work with a post-fork blockchain, you need to use solc 0.4.22 or better. If your backing chain is not Byzantium, then you need to use solc 0.4.21 or less.

If the two sides are not a match, then you will have head-scratcher trouble at the interface level.

Hope it helps.


As mentioned by Rob if the contract abi didn't match what the contract is expecting it will cause this problem. Try regenerating the contract abi or making sure it is the correct one.

If the abi is the correct one another common cause with javascript is that the value passed as parameter is undefined. For example when the name of the field is wrong, ie you missed or typed wrong a single letter, or perhaps the user didn't fill a field on the form.

My first approach with this problem is to log all the parameters passed to the function to ensure they are not undefined and set them to he right values.

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.