Does anybody know how to solve this? I've try to compile and deploy my contract to get the address, why obtained this error



   Deploying 'towater'
Error: Error: Error:  *** Deployment Failed ***

"towater" -- Invalid number of parameters for "undefined". Got 0 expected 2!.

    at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-migrate/index.js:92:1)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Truffle v5.0.24 (core: 5.0.24)
Node v10.16.0

that's image of error that I obtained

1_initial_migrations.js file:

var towater = artifacts.require("towater");

module.exports = function(deployer) {

enter image description here

  • Check in the migration file if you are specifying the constructor arguments of towater.
    – alberto
    Commented Jun 26, 2019 at 18:54
  • How I do this? Check my migration file
    – MrAbade
    Commented Jun 26, 2019 at 19:07
  • The constructor of towater have 2 params, string[] and bytes16[]
    – MrAbade
    Commented Jun 26, 2019 at 19:09

2 Answers 2


To solve the error you need to pass the arguments of the constructor in your migration file.

Based on your two params:

// Untested
// Deploy a single contract with constructor arguments
deployer.deploy(towater, ["string_1", "string_2"], ["0x15458ef540ade6068dfe2f44e8fa733c", "0x15458ef540ade6068dfe2f44e8fa734c"] );

Check the Truffle docs.

  • Thank you so muchhhhh, you helped me a lot!
    – MrAbade
    Commented Jun 26, 2019 at 21:48

When working with Truffle v5.0.39, the above-mentioned syntax is not valid. If the contract's constructor has arguments, the deploy function has to provide the arguments like this:

deployer.deploy( myContract, arg1, arg2, ...);

So, for example, if your constructor takes two addresses:

deployer.deploy(towater, "0x15458ef540ade6068dfe2f44e8fa733c", "0x15458ef540ade6068dfe2f44e8fa734c");

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.