I have a really strange problem. When I deploy a contract in JavaScriptVM using Remix including the following function:

function setLoanStatus(address _loan, bytes1 _newStatus) public {
    // "A" = 0x41 / "I" = 0x49 / "S" = 0x53 
    var check = (_newStatus == 0x41 || _newStatus == 0x49 || _newStatus == 0x53);
    if (check)
        // Only update status if it is a valid value
        loanStatusList[_loan] = _newStatus;
        } // if (check)

} // function setLoanStatus(address _loan, bytes1 _newStatus) public {

the contract appears to deploy, but if I try to look at any value I get the message:

error: Failed to decode output: TypeError: Cannot read property 'length' of undefined

If I change the visibility to internal it will deploy properly AND if I deploy the contract with original function in Injected Web3 it works properly. I am using the Ropsten testnet.

Any ideas why this behavior is happening?

1 Answer 1


This is actually a common problem among new remix users.

At the time of deploying in Javascript VM, try increasing the gas limit in the option below Javascript environment and accounts option.

The problem is that due to low gas limit, the contract is not getting properly deployed. So you are essentially communicating with a incomplete contract.

Increasing the gas limit will allow the contract to be deployed properly and problem will be gone for good.

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.