I am developing on a testnet on ganache and using remix. I am working with web3 and working on the user interface.

when trying to fetch a function with web3/ganache, I get the following error: "ERRError: VM Exception while processing transaction: invalid opcode".

The contract was deployed correctly and I even get results. But after a second or so, the message with the error comes. I call only a get function, nothing should have to change.

What could that be and what could I do?

1 Answer 1


Found it! I have ran the function 10 times because I wanted to get the recent 10 articles. But the thing was, there were only 3 articles. So I accessed function getArticle(uint _id) with it 4 but there were only articles 0, 1, 2.

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.