I am using testrpc. While running truffle migrate I get the following error:

        throw new Error(this.contract_name + " has no network configuration for its current network id (" + network_id + ").");

Error: XXXTokenFactory has no network configuration for its current network id (1497979617513).

My truffle.js as the following content

// Allows us to use ES6 in our migrations and tests.

module.exports = {
  networks: {
    development: {
      host: 'localhost',
      port: 8545,
      network_id: '*' // Match any network id

What am I missing? Would appreciate any help I get. Thanks

  • did you define your contract in migrations/2_deploy_contracts.js file?
    – Sanchit
    Jun 20 '17 at 18:56
  • Yes I did. Forgot to mention my XXXTokenFactory is an implementation of Open Zeppelin's MultisigWallet Jun 21 '17 at 4:07

This seems to occur if you're trying to deploy contract A that depends on contract B before contract B has actually finished deploying.

You probably have something like this:

module.exports = function(deployer, network, accounts) {
  deployer.deploy(A, B.address);

It's essentially a race condition because B.address is probably not ready in time for the second deployer.deploy call. So use the promise that deploy returns like this:

module.exports = function(deployer, network, accounts) {
  deployer.deploy(B).then(function() {
    return deployer.deploy(A, B.address);
  • This solution didn't work for me. keep getting the same error.
    – fccoelho
    Oct 17 '18 at 14:17
  • Same for me until I noticed the return statement. After adding that, it worked. Dec 5 '19 at 13:03

I prefer this syntax:

module.exports = function(deployer, network, accounts) {

    deployer.then(async () => {
        await deployer.deploy(A);
        await deployer.deploy(B, A.address);

since it's way more readable when you have lots of contracts.

See also: https://github.com/trufflesuite/truffle/issues/501#issuecomment-373886205

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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