1

Hey all I'm getting this error {"InstructionError": [2, {"Custom": 167}]} thrown when using connection.confirmTransaction.

Thus far I've interpreted what different instruction errors mean through tribal knowledge shared on Discord.

Is there a more official place I could look to find the interpretation for that error code?

1 Answer 1

5

InstructionErrors are a variant of TransactionError, a core feature, nothing to do with web3.js specifically.

The first item in the tuple is the index (zero-based) of the instruction which raised the error.

The second item is the actual InstructionError enum variant. In your example Custom which carries a u32 error code defined by the program which declared the corresponding instruction.

So the course of action here is to inspect the transaction to determine its third instruction. Use its program id to identify the project. Then hope that it is open source, has good docs or someone has reverse engineered the protocol already, so you can lookup the error.

You may be able to take a shortcut and instead infer what happened from the transaction logs if they exist and are informative

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.