I am trying to figure out what is wrong with the following code as it does deploy successfully on remix.

pragma solidity ^0.5.11;

contract MyContract {

    // Storage
    address contractOwner;

    address[] userFilesList;

    mapping ( string => address ) private accountAddressesByProfile;
    address[] public accountList;

    bytes16[] accountTypes;
    mapping(bytes16 => bool) accountTypesMap;

    constructor() public {
        contractOwner = msg.sender;

        bytes16[5] memory initialAccountTypes = [

        for (uint8 i = 0; i < initialAccountTypes.length; i++ ) {
            bytes16 accountType = initialAccountTypes[i];
            accountTypesMap[accountType] = true;


The issue is it refuses to deploy from remix when pointed to a remote node(in my case a parity node running of Azure proof of authority consortium).

I get the following error when I try to deploy on remix Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? "message" must be a nonempty string

And when I deploy anyway it fails with error 0x0 Transaction mined but execution failed.

However if I changed the pragma version to say 0.4.26 it deploys successfully. Im trying to understand what’s going on or see if perhaps it’s not good practice to implement the loop in the constructor.

  • Any updates to fixing this error?
    – Ender
    May 28, 2021 at 5:55

6 Answers 6


This happens when you make a change to your contract (typically add a new method) but fail to deploy the contract to the network.

In my case I failed to do so because of truffle. truffle migrate does not deploy the new contract code you have to explicitly tell truffle to deploy the new contract by truffle migrate --all

My guess is that Remix is trying to send a message for the new method added but the new method is not found in the previously deployed contract code on the network.

Edit: I got the same error also when I had too little gas upon calling the method, after fixing as above.

  • +1 as you led me onto the right track. In my case, truffle migrate --reset worked but not truffle migrate --all. I had added a public variable and re-deployed but without the "--reset" option. Very hard to understand error message... Dec 12, 2019 at 21:38
  • under rated answer
    – t-nail
    Jul 3, 2021 at 15:14

Set the GAS LIMIT to 9000000...should help.


I don't know what you are using for your deployment like 'Javascript VM' or 'injected web3', but maybe using 'injected web3' will solve your problem or if you are already using that, then go to metamask and try to reset your account.

This helped me get rid of this error but I am not sure if this is the right solution for you.

Note: New here! Any suggestions will be appreciated!!

  • thanks for the response. im using injected web3. i dont think the issue will be account reset because if i change the pragma version to something lower like i mentioned earlier it deploys successfully
    – Oaks-view
    Nov 6, 2019 at 9:37
  • Okay! then I don't know why this problem is coming! I'll make sure to update if I find out why this is hapening!
    – vteja711
    Nov 6, 2019 at 10:07
  • Maybe try changing the version of your solidity compiler in Remix
    – vteja711
    Nov 6, 2019 at 10:26

It seems that your contract are failed to compile with pragma solidity ^0.5.11 and thus you are trying to deploy empty byte code. That's why you get this "message" must be a nonempty string warning, and that's why deployment fails.

Probably the tool you are using for deployment runs Solidity 0.4.x.


I have tested your code in remix and its working fine for me in both cases, either using JavaScript VM or Injected Web3. I would suggest the following steps to try:

  1. First, in Remix select the compiler version 0.5.11+commit.c082d0b4 and try to deploy it with JavaScript VM. if this is successful then move to the next step.
  2. Change the Remix environment to Injected Web3. The Metamask window should popup asking to sign in to Metamsk if you have not done it before. Make sure you are connected to the right network in Metamask and the selected account should have some funds for that network. Now if you deploy the contract, the Metamask window should pop up again, asking for you to confirm the transaction.
  3. If still there is gas estimation error then increase the gas limit (perhaps try 8000000) or check the gas limits of your network.

hope it will work. enter image description here

  • so i tested as well using the test networks like rinkeby and you're right it deploys without problem. I guess it only happens when testing on the Azure POA consortium i deployed. not sure why though
    – Oaks-view
    Nov 6, 2019 at 14:50
  • can you check the gas limit for the network?
    – Yahya
    Nov 6, 2019 at 15:11
  • another thing you can try is when the Metamask window pops up, set the gas price to 0. you can do this by clicking on edit next to the GAS FEE option in the Metamak popup window.
    – Yahya
    Nov 6, 2019 at 15:19

I solved this error in remix by changing the compiler version to the latest and on the deploy section, i also changed the environment from injected provider to remix vm sepolia fork. Kindly note that i was trying to fund the fundme contract and was having a gas estimation failed error using the injected provider.

New contributor
Abigirl is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

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.