0

I am attempting to deploy a test contract on javascriptVM using Remix IDE in chrome. However when I try to execute the contract I receive this message in the status section.

"transact to Notes.addNote errored: VM error: invalid opcode. invalid opcode The execution might have thrown. Debug the transaction to get more information. "

pl let me know if anything wrong in mycode..

  • 4
    can you provide full code here in question? – Mahesh Rajput Jan 31 at 6:04
  • Are you adding the first note in the contract? Also adding the error string in require statements can be helpful to debug. – Aniket Jan 31 at 6:08
  • I think you are getting mixed up in note_id and index of array, if note at a particular index is not even created, how can you assign value directly by =. – sp4c3 Jan 31 at 7:55
0

Invalid opcode can be the result of either one of the following runtime operations:

  1. assert of an expression which evaluates to false
  2. array[i] where i >= array.length

In your code, only the second option appears viable.

It is viable in the expression userNotes[msg.sender][_noteId].

So the error must be the result of _noteId >= userNotes[msg.sender].length.

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.